From 8803490f4278a34166d959232622c00c3ffef68e Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Thu, 15 Sep 2022 13:08:20 +0200 Subject: [PATCH] Improve store templates/codegen, fix settings model def --- .../templates/gocode/store/interfaces.go.tpl | 6 +- .../templates/gocode/store/rdbms/rdbms.go.tpl | 9 +- codegen/server.store.cue | 15 +- store/adapters/rdbms/rdbms.gen.go | 184 +++++++++++++----- store/interfaces.gen.go | 42 ++++ system/model/models.gen.go | 1 - system/settings.cue | 2 +- 7 files changed, 197 insertions(+), 62 deletions(-) diff --git a/codegen/assets/templates/gocode/store/interfaces.go.tpl b/codegen/assets/templates/gocode/store/interfaces.go.tpl index d404a0e88..0fb8fc891 100644 --- a/codegen/assets/templates/gocode/store/interfaces.go.tpl +++ b/codegen/assets/templates/gocode/store/interfaces.go.tpl @@ -56,9 +56,10 @@ type ( Update{{ .expIdent }}(ctx context.Context, {{ template "extraArgs" .ident }} rr ...*{{ .goType }}) error Upsert{{ .expIdent }}(ctx context.Context, {{ template "extraArgs" .ident }} rr ...*{{ .goType }}) error Delete{{ .expIdent }}(ctx context.Context, {{ template "extraArgs" .ident }} rr ...*{{ .goType }}) error + {{ if .api.deleteByPK.expFnIdent }} {{ .api.deleteByPK.expFnIdent }}(ctx context.Context, {{ template "extraArgs" .ident }} {{ range .api.deleteByPK.attributes }}{{ .ident }} {{ .goType }},{{ end }}) error + {{- end }} Truncate{{ .expIdentPlural }}(ctx context.Context, {{ template "extraArgs" .ident }}) error - {{- range .api.lookups }} {{ .expFnIdent }}(ctx context.Context, {{ template "extraArgs" .ident }} {{ range .args }}{{ .ident }} {{ .goType }}, {{ end }}) (*{{ .returnType }}, error) {{- end }} @@ -105,13 +106,14 @@ type ( return s.Delete{{ .expIdent }}(ctx, {{ template "extraParams" .ident }}rr...) } +{{ if .api.deleteByPK.expFnIdent }} // Delete{{ .expIdent }}ByID deletes one or more {{ .expIdentPlural }} from store // // This function is auto-generated func {{ .api.deleteByPK.expFnIdent }}(ctx context.Context, s {{ .expIdentPlural }}, {{ template "extraArgs" .ident }} {{ range .api.deleteByPK.attributes }}{{ .ident }} {{ .goType }},{{ end }}) error { return s.{{ .api.deleteByPK.expFnIdent }}(ctx, {{ template "extraParams" .ident }}{{ range .api.deleteByPK.attributes }}{{ .ident }},{{ end }}) } - +{{ end }} // Truncate{{ .expIdentPlural }} Deletes all {{ .expIdentPlural }} from store // // This function is auto-generated diff --git a/codegen/assets/templates/gocode/store/rdbms/rdbms.go.tpl b/codegen/assets/templates/gocode/store/rdbms/rdbms.go.tpl index 8244f3bba..fa5b27b3b 100644 --- a/codegen/assets/templates/gocode/store/rdbms/rdbms.go.tpl +++ b/codegen/assets/templates/gocode/store/rdbms/rdbms.go.tpl @@ -100,7 +100,8 @@ func (s *Store) Delete{{ .expIdent }}(ctx context.Context, {{ template "extraArg return nil } -// Delete{{ .expIdent }}ByID deletes single entry from {{ .ident }} collection +{{ if .api.deleteByPK.expFnIdent }} +// {{ .api.deleteByPK.expFnIdent }} deletes single entry from {{ .ident }} collection // // This function is auto-generated func (s *Store) {{ .api.deleteByPK.expFnIdent }}(ctx context.Context, {{ template "extraArgs" .ident }} {{ range .api.deleteByPK.attributes }}{{ .ident }} {{ .goType }},{{ end }}) error { @@ -110,9 +111,10 @@ func (s *Store) {{ .api.deleteByPK.expFnIdent }}(ctx context.Context, {{ templat {{- end }} })) } +{{ end }} // Truncate{{ .expIdentPlural }} Deletes all rows from the {{ .ident }} collection -func (s Store) Truncate{{ .expIdentPlural }}(ctx context.Context, {{ template "extraArgs" .ident }}) error { +func (s *Store) Truncate{{ .expIdentPlural }}(ctx context.Context, {{ template "extraArgs" .ident }}) error { return s.Exec(ctx, {{ .ident }}TruncateQuery(s.Dialect)) } @@ -540,6 +542,9 @@ func (s *Store) {{ .fnIdent }}(res *{{ .goType }}, cc ...*filter.SortExpr) *filt } ) + + _ = hasUnique + collect(cc...) {{- range .primaryKeys }} if !hasUnique || !pk{{ .expIdent }} { diff --git a/codegen/server.store.cue b/codegen/server.store.cue index c7e8a15c5..c447cb1c9 100644 --- a/codegen/server.store.cue +++ b/codegen/server.store.cue @@ -14,8 +14,9 @@ _StoreResource: { pkAttrNames: [string, ...] + hasPrimaryKey: res.model.indexes.primary != _|_ - if res.model.indexes.primary != _|_ { + if hasPrimaryKey { // primary key flag is no longer explicitly set on // the attribute but via model.indexes.primary pkAttrNames: [ @@ -80,11 +81,13 @@ _StoreResource: { "auxIdent": auxIdent } - deleteByPK: { - "pkAttrNames": pkAttrNames, - attributes: [ for attr in pkAttrNames { res.model.attributes[attr] } ] - _expIdents: strings.Join([ for attr in pkAttrNames { res.model.attributes[attr].expIdent } ], "") - "expFnIdent": "Delete\(res.store.expIdent)By\(_expIdents)" + if hasPrimaryKey { + deleteByPK: { + "pkAttrNames": pkAttrNames, + attributes: [ for attr in pkAttrNames { res.model.attributes[attr] } ] + _expIdents: strings.Join([ for attr in pkAttrNames { res.model.attributes[attr].expIdent } ], "") + "expFnIdent": "Delete\(res.store.expIdent)By\(_expIdents)" + } } lookups: [ diff --git a/store/adapters/rdbms/rdbms.gen.go b/store/adapters/rdbms/rdbms.gen.go index b74832f82..76b53d5bc 100644 --- a/store/adapters/rdbms/rdbms.gen.go +++ b/store/adapters/rdbms/rdbms.gen.go @@ -147,7 +147,7 @@ func (s *Store) DeleteActionlogByID(ctx context.Context, id uint64) error { } // TruncateActionlogs Deletes all rows from the actionlog collection -func (s Store) TruncateActionlogs(ctx context.Context) error { +func (s *Store) TruncateActionlogs(ctx context.Context) error { return s.Exec(ctx, actionlogTruncateQuery(s.Dialect)) } @@ -344,6 +344,8 @@ func (s *Store) collectActionlogCursorValues(res *actionlogType.Action, cc ...*f } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -438,7 +440,7 @@ func (s *Store) DeleteApigwFilterByID(ctx context.Context, id uint64) error { } // TruncateApigwFilters Deletes all rows from the apigwFilter collection -func (s Store) TruncateApigwFilters(ctx context.Context) error { +func (s *Store) TruncateApigwFilters(ctx context.Context) error { return s.Exec(ctx, apigwFilterTruncateQuery(s.Dialect)) } @@ -878,6 +880,8 @@ func (s *Store) collectApigwFilterCursorValues(res *systemType.ApigwFilter, cc . } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -972,7 +976,7 @@ func (s *Store) DeleteApigwRouteByID(ctx context.Context, id uint64) error { } // TruncateApigwRoutes Deletes all rows from the apigwRoute collection -func (s Store) TruncateApigwRoutes(ctx context.Context) error { +func (s *Store) TruncateApigwRoutes(ctx context.Context) error { return s.Exec(ctx, apigwRouteTruncateQuery(s.Dialect)) } @@ -1416,6 +1420,8 @@ func (s *Store) collectApigwRouteCursorValues(res *systemType.ApigwRoute, cc ... } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -1510,7 +1516,7 @@ func (s *Store) DeleteApplicationByID(ctx context.Context, id uint64) error { } // TruncateApplications Deletes all rows from the application collection -func (s Store) TruncateApplications(ctx context.Context) error { +func (s *Store) TruncateApplications(ctx context.Context) error { return s.Exec(ctx, applicationTruncateQuery(s.Dialect)) } @@ -1909,6 +1915,8 @@ func (s *Store) collectApplicationCursorValues(res *systemType.Application, cc . } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -2003,7 +2011,7 @@ func (s *Store) DeleteAttachmentByID(ctx context.Context, id uint64) error { } // TruncateAttachments Deletes all rows from the attachment collection -func (s Store) TruncateAttachments(ctx context.Context) error { +func (s *Store) TruncateAttachments(ctx context.Context) error { return s.Exec(ctx, attachmentTruncateQuery(s.Dialect)) } @@ -2397,6 +2405,8 @@ func (s *Store) collectAttachmentCursorValues(res *systemType.Attachment, cc ... } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -2491,7 +2501,7 @@ func (s *Store) DeleteAuthClientByID(ctx context.Context, id uint64) error { } // TruncateAuthClients Deletes all rows from the authClient collection -func (s Store) TruncateAuthClients(ctx context.Context) error { +func (s *Store) TruncateAuthClients(ctx context.Context) error { return s.Exec(ctx, authClientTruncateQuery(s.Dialect)) } @@ -2942,6 +2952,8 @@ func (s *Store) collectAuthClientCursorValues(res *systemType.AuthClient, cc ... } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -3053,7 +3065,7 @@ func (s *Store) DeleteAuthConfirmedClient(ctx context.Context, rr ...*systemType return nil } -// DeleteAuthConfirmedClientByID deletes single entry from authConfirmedClient collection +// DeleteAuthConfirmedClientByUserIDClientID deletes single entry from authConfirmedClient collection // // This function is auto-generated func (s *Store) DeleteAuthConfirmedClientByUserIDClientID(ctx context.Context, userID uint64, clientID uint64) error { @@ -3064,7 +3076,7 @@ func (s *Store) DeleteAuthConfirmedClientByUserIDClientID(ctx context.Context, u } // TruncateAuthConfirmedClients Deletes all rows from the authConfirmedClient collection -func (s Store) TruncateAuthConfirmedClients(ctx context.Context) error { +func (s *Store) TruncateAuthConfirmedClients(ctx context.Context) error { return s.Exec(ctx, authConfirmedClientTruncateQuery(s.Dialect)) } @@ -3258,6 +3270,8 @@ func (s *Store) collectAuthConfirmedClientCursorValues(res *systemType.AuthConfi } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkUserID { collect(&filter.SortExpr{Column: "userID", Descending: false}) @@ -3355,7 +3369,7 @@ func (s *Store) DeleteAuthOa2tokenByID(ctx context.Context, id uint64) error { } // TruncateAuthOa2tokens Deletes all rows from the authOa2token collection -func (s Store) TruncateAuthOa2tokens(ctx context.Context) error { +func (s *Store) TruncateAuthOa2tokens(ctx context.Context) error { return s.Exec(ctx, authOa2tokenTruncateQuery(s.Dialect)) } @@ -3665,6 +3679,8 @@ func (s *Store) collectAuthOa2tokenCursorValues(res *systemType.AuthOa2token, cc } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -3759,7 +3775,7 @@ func (s *Store) DeleteAuthSessionByID(ctx context.Context, id string) error { } // TruncateAuthSessions Deletes all rows from the authSession collection -func (s Store) TruncateAuthSessions(ctx context.Context) error { +func (s *Store) TruncateAuthSessions(ctx context.Context) error { return s.Exec(ctx, authSessionTruncateQuery(s.Dialect)) } @@ -3949,6 +3965,8 @@ func (s *Store) collectAuthSessionCursorValues(res *systemType.AuthSession, cc . } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -4043,7 +4061,7 @@ func (s *Store) DeleteAutomationSessionByID(ctx context.Context, id uint64) erro } // TruncateAutomationSessions Deletes all rows from the automationSession collection -func (s Store) TruncateAutomationSessions(ctx context.Context) error { +func (s *Store) TruncateAutomationSessions(ctx context.Context) error { return s.Exec(ctx, automationSessionTruncateQuery(s.Dialect)) } @@ -4452,6 +4470,8 @@ func (s *Store) collectAutomationSessionCursorValues(res *automationType.Session } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -4546,7 +4566,7 @@ func (s *Store) DeleteAutomationTriggerByID(ctx context.Context, id uint64) erro } // TruncateAutomationTriggers Deletes all rows from the automationTrigger collection -func (s Store) TruncateAutomationTriggers(ctx context.Context) error { +func (s *Store) TruncateAutomationTriggers(ctx context.Context) error { return s.Exec(ctx, automationTriggerTruncateQuery(s.Dialect)) } @@ -4951,6 +4971,8 @@ func (s *Store) collectAutomationTriggerCursorValues(res *automationType.Trigger } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -5045,7 +5067,7 @@ func (s *Store) DeleteAutomationWorkflowByID(ctx context.Context, id uint64) err } // TruncateAutomationWorkflows Deletes all rows from the automationWorkflow collection -func (s Store) TruncateAutomationWorkflows(ctx context.Context) error { +func (s *Store) TruncateAutomationWorkflows(ctx context.Context) error { return s.Exec(ctx, automationWorkflowTruncateQuery(s.Dialect)) } @@ -5485,6 +5507,8 @@ func (s *Store) collectAutomationWorkflowCursorValues(res *automationType.Workfl } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -5606,7 +5630,7 @@ func (s *Store) DeleteComposeAttachmentByID(ctx context.Context, id uint64) erro } // TruncateComposeAttachments Deletes all rows from the composeAttachment collection -func (s Store) TruncateComposeAttachments(ctx context.Context) error { +func (s *Store) TruncateComposeAttachments(ctx context.Context) error { return s.Exec(ctx, composeAttachmentTruncateQuery(s.Dialect)) } @@ -6004,6 +6028,8 @@ func (s *Store) collectComposeAttachmentCursorValues(res *composeType.Attachment } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -6098,7 +6124,7 @@ func (s *Store) DeleteComposeChartByID(ctx context.Context, id uint64) error { } // TruncateComposeCharts Deletes all rows from the composeChart collection -func (s Store) TruncateComposeCharts(ctx context.Context) error { +func (s *Store) TruncateComposeCharts(ctx context.Context) error { return s.Exec(ctx, composeChartTruncateQuery(s.Dialect)) } @@ -6537,6 +6563,8 @@ func (s *Store) collectComposeChartCursorValues(res *composeType.Chart, cc ...*f } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -6631,7 +6659,7 @@ func (s *Store) DeleteComposeModuleByID(ctx context.Context, id uint64) error { } // TruncateComposeModules Deletes all rows from the composeModule collection -func (s Store) TruncateComposeModules(ctx context.Context) error { +func (s *Store) TruncateComposeModules(ctx context.Context) error { return s.Exec(ctx, composeModuleTruncateQuery(s.Dialect)) } @@ -7112,6 +7140,8 @@ func (s *Store) collectComposeModuleCursorValues(res *composeType.Module, cc ... } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -7238,7 +7268,7 @@ func (s *Store) DeleteComposeModuleFieldByID(ctx context.Context, id uint64) err } // TruncateComposeModuleFields Deletes all rows from the composeModuleField collection -func (s Store) TruncateComposeModuleFields(ctx context.Context) error { +func (s *Store) TruncateComposeModuleFields(ctx context.Context) error { return s.Exec(ctx, composeModuleFieldTruncateQuery(s.Dialect)) } @@ -7486,6 +7516,8 @@ func (s *Store) collectComposeModuleFieldCursorValues(res *composeType.ModuleFie } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -7612,7 +7644,7 @@ func (s *Store) DeleteComposeNamespaceByID(ctx context.Context, id uint64) error } // TruncateComposeNamespaces Deletes all rows from the composeNamespace collection -func (s Store) TruncateComposeNamespaces(ctx context.Context) error { +func (s *Store) TruncateComposeNamespaces(ctx context.Context) error { return s.Exec(ctx, composeNamespaceTruncateQuery(s.Dialect)) } @@ -8049,6 +8081,8 @@ func (s *Store) collectComposeNamespaceCursorValues(res *composeType.Namespace, } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -8170,7 +8204,7 @@ func (s *Store) DeleteComposePageByID(ctx context.Context, id uint64) error { } // TruncateComposePages Deletes all rows from the composePage collection -func (s Store) TruncateComposePages(ctx context.Context) error { +func (s *Store) TruncateComposePages(ctx context.Context) error { return s.Exec(ctx, composePageTruncateQuery(s.Dialect)) } @@ -8658,6 +8692,8 @@ func (s *Store) collectComposePageCursorValues(res *composeType.Page, cc ...*fil } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -8752,7 +8788,7 @@ func (s *Store) DeleteCredentialByID(ctx context.Context, id uint64) error { } // TruncateCredentials Deletes all rows from the credential collection -func (s Store) TruncateCredentials(ctx context.Context) error { +func (s *Store) TruncateCredentials(ctx context.Context) error { return s.Exec(ctx, credentialTruncateQuery(s.Dialect)) } @@ -8956,6 +8992,8 @@ func (s *Store) collectCredentialCursorValues(res *systemType.Credential, cc ... } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -9050,7 +9088,7 @@ func (s *Store) DeleteDalConnectionByID(ctx context.Context, id uint64) error { } // TruncateDalConnections Deletes all rows from the dalConnection collection -func (s Store) TruncateDalConnections(ctx context.Context) error { +func (s *Store) TruncateDalConnections(ctx context.Context) error { return s.Exec(ctx, dalConnectionTruncateQuery(s.Dialect)) } @@ -9308,6 +9346,8 @@ func (s *Store) collectDalConnectionCursorValues(res *systemType.DalConnection, } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -9429,7 +9469,7 @@ func (s *Store) DeleteDalSensitivityLevelByID(ctx context.Context, id uint64) er } // TruncateDalSensitivityLevels Deletes all rows from the dalSensitivityLevel collection -func (s Store) TruncateDalSensitivityLevels(ctx context.Context) error { +func (s *Store) TruncateDalSensitivityLevels(ctx context.Context) error { return s.Exec(ctx, dalSensitivityLevelTruncateQuery(s.Dialect)) } @@ -9644,6 +9684,8 @@ func (s *Store) collectDalSensitivityLevelCursorValues(res *systemType.DalSensit } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -9738,7 +9780,7 @@ func (s *Store) DeleteDataPrivacyRequestByID(ctx context.Context, id uint64) err } // TruncateDataPrivacyRequests Deletes all rows from the dataPrivacyRequest collection -func (s Store) TruncateDataPrivacyRequests(ctx context.Context) error { +func (s *Store) TruncateDataPrivacyRequests(ctx context.Context) error { return s.Exec(ctx, dataPrivacyRequestTruncateQuery(s.Dialect)) } @@ -10142,6 +10184,8 @@ func (s *Store) collectDataPrivacyRequestCursorValues(res *systemType.DataPrivac } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -10236,7 +10280,7 @@ func (s *Store) DeleteDataPrivacyRequestCommentByID(ctx context.Context, id uint } // TruncateDataPrivacyRequestComments Deletes all rows from the dataPrivacyRequestComment collection -func (s Store) TruncateDataPrivacyRequestComments(ctx context.Context) error { +func (s *Store) TruncateDataPrivacyRequestComments(ctx context.Context) error { return s.Exec(ctx, dataPrivacyRequestCommentTruncateQuery(s.Dialect)) } @@ -10584,6 +10628,8 @@ func (s *Store) collectDataPrivacyRequestCommentCursorValues(res *systemType.Dat } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -10678,7 +10724,7 @@ func (s *Store) DeleteFederationExposedModuleByID(ctx context.Context, id uint64 } // TruncateFederationExposedModules Deletes all rows from the federationExposedModule collection -func (s Store) TruncateFederationExposedModules(ctx context.Context) error { +func (s *Store) TruncateFederationExposedModules(ctx context.Context) error { return s.Exec(ctx, federationExposedModuleTruncateQuery(s.Dialect)) } @@ -11079,6 +11125,8 @@ func (s *Store) collectFederationExposedModuleCursorValues(res *federationType.E } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -11163,7 +11211,7 @@ func (s *Store) DeleteFederationModuleMapping(ctx context.Context, rr ...*federa return nil } -// DeleteFederationModuleMappingByID deletes single entry from federationModuleMapping collection +// DeleteFederationModuleMappingByNodeID deletes single entry from federationModuleMapping collection // // This function is auto-generated func (s *Store) DeleteFederationModuleMappingByNodeID(ctx context.Context, nodeID uint64) error { @@ -11173,7 +11221,7 @@ func (s *Store) DeleteFederationModuleMappingByNodeID(ctx context.Context, nodeI } // TruncateFederationModuleMappings Deletes all rows from the federationModuleMapping collection -func (s Store) TruncateFederationModuleMappings(ctx context.Context) error { +func (s *Store) TruncateFederationModuleMappings(ctx context.Context) error { return s.Exec(ctx, federationModuleMappingTruncateQuery(s.Dialect)) } @@ -11608,6 +11656,8 @@ func (s *Store) collectFederationModuleMappingCursorValues(res *federationType.M } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkNodeID { collect(&filter.SortExpr{Column: "nodeID", Descending: false}) @@ -11702,7 +11752,7 @@ func (s *Store) DeleteFederationNodeByID(ctx context.Context, id uint64) error { } // TruncateFederationNodes Deletes all rows from the federationNode collection -func (s Store) TruncateFederationNodes(ctx context.Context) error { +func (s *Store) TruncateFederationNodes(ctx context.Context) error { return s.Exec(ctx, federationNodeTruncateQuery(s.Dialect)) } @@ -12008,6 +12058,8 @@ func (s *Store) collectFederationNodeCursorValues(res *federationType.Node, cc . } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -12092,7 +12144,7 @@ func (s *Store) DeleteFederationNodeSync(ctx context.Context, rr ...*federationT return nil } -// DeleteFederationNodeSyncByID deletes single entry from federationNodeSync collection +// DeleteFederationNodeSyncByNodeID deletes single entry from federationNodeSync collection // // This function is auto-generated func (s *Store) DeleteFederationNodeSyncByNodeID(ctx context.Context, nodeID uint64) error { @@ -12102,7 +12154,7 @@ func (s *Store) DeleteFederationNodeSyncByNodeID(ctx context.Context, nodeID uin } // TruncateFederationNodeSyncs Deletes all rows from the federationNodeSync collection -func (s Store) TruncateFederationNodeSyncs(ctx context.Context) error { +func (s *Store) TruncateFederationNodeSyncs(ctx context.Context) error { return s.Exec(ctx, federationNodeSyncTruncateQuery(s.Dialect)) } @@ -12542,6 +12594,8 @@ func (s *Store) collectFederationNodeSyncCursorValues(res *federationType.NodeSy } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkNodeID { collect(&filter.SortExpr{Column: "nodeID", Descending: false}) @@ -12636,7 +12690,7 @@ func (s *Store) DeleteFederationSharedModuleByID(ctx context.Context, id uint64) } // TruncateFederationSharedModules Deletes all rows from the federationSharedModule collection -func (s Store) TruncateFederationSharedModules(ctx context.Context) error { +func (s *Store) TruncateFederationSharedModules(ctx context.Context) error { return s.Exec(ctx, federationSharedModuleTruncateQuery(s.Dialect)) } @@ -13041,6 +13095,8 @@ func (s *Store) collectFederationSharedModuleCursorValues(res *federationType.Sh } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -13125,7 +13181,7 @@ func (s *Store) DeleteFlag(ctx context.Context, rr ...*flagType.Flag) (err error return nil } -// DeleteFlagByID deletes single entry from flag collection +// DeleteFlagByKindResourceIDOwnedByName deletes single entry from flag collection // // This function is auto-generated func (s *Store) DeleteFlagByKindResourceIDOwnedByName(ctx context.Context, kind string, resourceID uint64, ownedBy uint64, name string) error { @@ -13138,7 +13194,7 @@ func (s *Store) DeleteFlagByKindResourceIDOwnedByName(ctx context.Context, kind } // TruncateFlags Deletes all rows from the flag collection -func (s Store) TruncateFlags(ctx context.Context) error { +func (s *Store) TruncateFlags(ctx context.Context) error { return s.Exec(ctx, flagTruncateQuery(s.Dialect)) } @@ -13340,6 +13396,8 @@ func (s *Store) collectFlagCursorValues(res *flagType.Flag, cc ...*filter.SortEx } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkKind { collect(&filter.SortExpr{Column: "kind", Descending: false}) @@ -13433,7 +13491,7 @@ func (s *Store) DeleteLabel(ctx context.Context, rr ...*labelsType.Label) (err e return nil } -// DeleteLabelByID deletes single entry from label collection +// DeleteLabelByKindResourceIDName deletes single entry from label collection // // This function is auto-generated func (s *Store) DeleteLabelByKindResourceIDName(ctx context.Context, kind string, resourceID uint64, name string) error { @@ -13445,7 +13503,7 @@ func (s *Store) DeleteLabelByKindResourceIDName(ctx context.Context, kind string } // TruncateLabels Deletes all rows from the label collection -func (s Store) TruncateLabels(ctx context.Context) error { +func (s *Store) TruncateLabels(ctx context.Context) error { return s.Exec(ctx, labelTruncateQuery(s.Dialect)) } @@ -13640,6 +13698,8 @@ func (s *Store) collectLabelCursorValues(res *labelsType.Label, cc ...*filter.So } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkKind { collect(&filter.SortExpr{Column: "kind", Descending: false}) @@ -13740,7 +13800,7 @@ func (s *Store) DeleteQueueByID(ctx context.Context, id uint64) error { } // TruncateQueues Deletes all rows from the queue collection -func (s Store) TruncateQueues(ctx context.Context) error { +func (s *Store) TruncateQueues(ctx context.Context) error { return s.Exec(ctx, queueTruncateQuery(s.Dialect)) } @@ -14174,6 +14234,8 @@ func (s *Store) collectQueueCursorValues(res *systemType.Queue, cc ...*filter.So } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -14268,7 +14330,7 @@ func (s *Store) DeleteQueueMessageByID(ctx context.Context, id uint64) error { } // TruncateQueueMessages Deletes all rows from the queueMessage collection -func (s Store) TruncateQueueMessages(ctx context.Context) error { +func (s *Store) TruncateQueueMessages(ctx context.Context) error { return s.Exec(ctx, queueMessageTruncateQuery(s.Dialect)) } @@ -14601,6 +14663,8 @@ func (s *Store) collectQueueMessageCursorValues(res *systemType.QueueMessage, cc } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -14685,7 +14749,7 @@ func (s *Store) DeleteRbacRule(ctx context.Context, rr ...*rbacType.Rule) (err e return nil } -// DeleteRbacRuleByID deletes single entry from rbacRule collection +// DeleteRbacRuleByRoleIDResourceOperation deletes single entry from rbacRule collection // // This function is auto-generated func (s *Store) DeleteRbacRuleByRoleIDResourceOperation(ctx context.Context, roleID uint64, resource string, operation string) error { @@ -14697,7 +14761,7 @@ func (s *Store) DeleteRbacRuleByRoleIDResourceOperation(ctx context.Context, rol } // TruncateRbacRules Deletes all rows from the rbacRule collection -func (s Store) TruncateRbacRules(ctx context.Context) error { +func (s *Store) TruncateRbacRules(ctx context.Context) error { return s.Exec(ctx, rbacRuleTruncateQuery(s.Dialect)) } @@ -14850,6 +14914,8 @@ func (s *Store) collectRbacRuleCursorValues(res *rbacType.Rule, cc ...*filter.So } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkRoleID { collect(&filter.SortExpr{Column: "roleID", Descending: false}) @@ -14950,7 +15016,7 @@ func (s *Store) DeleteReminderByID(ctx context.Context, id uint64) error { } // TruncateReminders Deletes all rows from the reminder collection -func (s Store) TruncateReminders(ctx context.Context) error { +func (s *Store) TruncateReminders(ctx context.Context) error { return s.Exec(ctx, reminderTruncateQuery(s.Dialect)) } @@ -15353,6 +15419,8 @@ func (s *Store) collectReminderCursorValues(res *systemType.Reminder, cc ...*fil } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -15447,7 +15515,7 @@ func (s *Store) DeleteReportByID(ctx context.Context, id uint64) error { } // TruncateReports Deletes all rows from the report collection -func (s Store) TruncateReports(ctx context.Context) error { +func (s *Store) TruncateReports(ctx context.Context) error { return s.Exec(ctx, reportTruncateQuery(s.Dialect)) } @@ -15884,6 +15952,8 @@ func (s *Store) collectReportCursorValues(res *systemType.Report, cc ...*filter. } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -16005,7 +16075,7 @@ func (s *Store) DeleteResourceActivityByID(ctx context.Context, id uint64) error } // TruncateResourceActivitys Deletes all rows from the resourceActivity collection -func (s Store) TruncateResourceActivitys(ctx context.Context) error { +func (s *Store) TruncateResourceActivitys(ctx context.Context) error { return s.Exec(ctx, resourceActivityTruncateQuery(s.Dialect)) } @@ -16150,6 +16220,8 @@ func (s *Store) collectResourceActivityCursorValues(res *discoveryType.ResourceA } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -16244,7 +16316,7 @@ func (s *Store) DeleteResourceTranslationByID(ctx context.Context, id uint64) er } // TruncateResourceTranslations Deletes all rows from the resourceTranslation collection -func (s Store) TruncateResourceTranslations(ctx context.Context) error { +func (s *Store) TruncateResourceTranslations(ctx context.Context) error { return s.Exec(ctx, resourceTranslationTruncateQuery(s.Dialect)) } @@ -16621,6 +16693,8 @@ func (s *Store) collectResourceTranslationCursorValues(res *systemType.ResourceT } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -16715,7 +16789,7 @@ func (s *Store) DeleteRoleByID(ctx context.Context, id uint64) error { } // TruncateRoles Deletes all rows from the role collection -func (s Store) TruncateRoles(ctx context.Context) error { +func (s *Store) TruncateRoles(ctx context.Context) error { return s.Exec(ctx, roleTruncateQuery(s.Dialect)) } @@ -17202,6 +17276,8 @@ func (s *Store) collectRoleCursorValues(res *systemType.Role, cc ...*filter.Sort } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -17340,7 +17416,7 @@ func (s *Store) DeleteRoleMember(ctx context.Context, rr ...*systemType.RoleMemb return nil } -// DeleteRoleMemberByID deletes single entry from roleMember collection +// DeleteRoleMemberByUserIDRoleID deletes single entry from roleMember collection // // This function is auto-generated func (s *Store) DeleteRoleMemberByUserIDRoleID(ctx context.Context, userID uint64, roleID uint64) error { @@ -17351,7 +17427,7 @@ func (s *Store) DeleteRoleMemberByUserIDRoleID(ctx context.Context, userID uint6 } // TruncateRoleMembers Deletes all rows from the roleMember collection -func (s Store) TruncateRoleMembers(ctx context.Context) error { +func (s *Store) TruncateRoleMembers(ctx context.Context) error { return s.Exec(ctx, roleMemberTruncateQuery(s.Dialect)) } @@ -17500,6 +17576,8 @@ func (s *Store) collectRoleMemberCursorValues(res *systemType.RoleMember, cc ... } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkUserID { collect(&filter.SortExpr{Column: "userID", Descending: false}) @@ -17587,7 +17665,7 @@ func (s *Store) DeleteSettingValue(ctx context.Context, rr ...*systemType.Settin return nil } -// DeleteSettingValueByID deletes single entry from settingValue collection +// DeleteSettingValueByOwnedByName deletes single entry from settingValue collection // // This function is auto-generated func (s *Store) DeleteSettingValueByOwnedByName(ctx context.Context, ownedBy uint64, name string) error { @@ -17598,7 +17676,7 @@ func (s *Store) DeleteSettingValueByOwnedByName(ctx context.Context, ownedBy uin } // TruncateSettingValues Deletes all rows from the settingValue collection -func (s Store) TruncateSettingValues(ctx context.Context) error { +func (s *Store) TruncateSettingValues(ctx context.Context) error { return s.Exec(ctx, settingValueTruncateQuery(s.Dialect)) } @@ -17791,6 +17869,8 @@ func (s *Store) collectSettingValueCursorValues(res *systemType.SettingValue, cc } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkOwnedBy { collect(&filter.SortExpr{Column: "ownedBy", Descending: false}) @@ -17888,7 +17968,7 @@ func (s *Store) DeleteTemplateByID(ctx context.Context, id uint64) error { } // TruncateTemplates Deletes all rows from the template collection -func (s Store) TruncateTemplates(ctx context.Context) error { +func (s *Store) TruncateTemplates(ctx context.Context) error { return s.Exec(ctx, templateTruncateQuery(s.Dialect)) } @@ -18338,6 +18418,8 @@ func (s *Store) collectTemplateCursorValues(res *systemType.Template, cc ...*fil } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) @@ -18459,7 +18541,7 @@ func (s *Store) DeleteUserByID(ctx context.Context, id uint64) error { } // TruncateUsers Deletes all rows from the user collection -func (s Store) TruncateUsers(ctx context.Context) error { +func (s *Store) TruncateUsers(ctx context.Context) error { return s.Exec(ctx, userTruncateQuery(s.Dialect)) } @@ -19000,6 +19082,8 @@ func (s *Store) collectUserCursorValues(res *systemType.User, cc ...*filter.Sort } ) + _ = hasUnique + collect(cc...) if !hasUnique || !pkID { collect(&filter.SortExpr{Column: "id", Descending: false}) diff --git a/store/interfaces.gen.go b/store/interfaces.gen.go index fded328bc..f41617251 100644 --- a/store/interfaces.gen.go +++ b/store/interfaces.gen.go @@ -94,6 +94,7 @@ type ( UpdateActionlog(ctx context.Context, rr ...*actionlogType.Action) error UpsertActionlog(ctx context.Context, rr ...*actionlogType.Action) error DeleteActionlog(ctx context.Context, rr ...*actionlogType.Action) error + DeleteActionlogByID(ctx context.Context, id uint64) error TruncateActionlogs(ctx context.Context) error LookupActionlogByID(ctx context.Context, id uint64) (*actionlogType.Action, error) @@ -105,6 +106,7 @@ type ( UpdateApigwFilter(ctx context.Context, rr ...*systemType.ApigwFilter) error UpsertApigwFilter(ctx context.Context, rr ...*systemType.ApigwFilter) error DeleteApigwFilter(ctx context.Context, rr ...*systemType.ApigwFilter) error + DeleteApigwFilterByID(ctx context.Context, id uint64) error TruncateApigwFilters(ctx context.Context) error LookupApigwFilterByID(ctx context.Context, id uint64) (*systemType.ApigwFilter, error) @@ -117,6 +119,7 @@ type ( UpdateApigwRoute(ctx context.Context, rr ...*systemType.ApigwRoute) error UpsertApigwRoute(ctx context.Context, rr ...*systemType.ApigwRoute) error DeleteApigwRoute(ctx context.Context, rr ...*systemType.ApigwRoute) error + DeleteApigwRouteByID(ctx context.Context, id uint64) error TruncateApigwRoutes(ctx context.Context) error LookupApigwRouteByID(ctx context.Context, id uint64) (*systemType.ApigwRoute, error) @@ -129,6 +132,7 @@ type ( UpdateApplication(ctx context.Context, rr ...*systemType.Application) error UpsertApplication(ctx context.Context, rr ...*systemType.Application) error DeleteApplication(ctx context.Context, rr ...*systemType.Application) error + DeleteApplicationByID(ctx context.Context, id uint64) error TruncateApplications(ctx context.Context) error LookupApplicationByID(ctx context.Context, id uint64) (*systemType.Application, error) @@ -142,6 +146,7 @@ type ( UpdateAttachment(ctx context.Context, rr ...*systemType.Attachment) error UpsertAttachment(ctx context.Context, rr ...*systemType.Attachment) error DeleteAttachment(ctx context.Context, rr ...*systemType.Attachment) error + DeleteAttachmentByID(ctx context.Context, id uint64) error TruncateAttachments(ctx context.Context) error LookupAttachmentByID(ctx context.Context, id uint64) (*systemType.Attachment, error) @@ -153,6 +158,7 @@ type ( UpdateAuthClient(ctx context.Context, rr ...*systemType.AuthClient) error UpsertAuthClient(ctx context.Context, rr ...*systemType.AuthClient) error DeleteAuthClient(ctx context.Context, rr ...*systemType.AuthClient) error + DeleteAuthClientByID(ctx context.Context, id uint64) error TruncateAuthClients(ctx context.Context) error LookupAuthClientByID(ctx context.Context, id uint64) (*systemType.AuthClient, error) @@ -165,6 +171,7 @@ type ( UpdateAuthConfirmedClient(ctx context.Context, rr ...*systemType.AuthConfirmedClient) error UpsertAuthConfirmedClient(ctx context.Context, rr ...*systemType.AuthConfirmedClient) error DeleteAuthConfirmedClient(ctx context.Context, rr ...*systemType.AuthConfirmedClient) error + DeleteAuthConfirmedClientByUserIDClientID(ctx context.Context, userID uint64, clientID uint64) error TruncateAuthConfirmedClients(ctx context.Context) error LookupAuthConfirmedClientByUserIDClientID(ctx context.Context, userID uint64, clientID uint64) (*systemType.AuthConfirmedClient, error) @@ -176,6 +183,7 @@ type ( UpdateAuthOa2token(ctx context.Context, rr ...*systemType.AuthOa2token) error UpsertAuthOa2token(ctx context.Context, rr ...*systemType.AuthOa2token) error DeleteAuthOa2token(ctx context.Context, rr ...*systemType.AuthOa2token) error + DeleteAuthOa2tokenByID(ctx context.Context, id uint64) error TruncateAuthOa2tokens(ctx context.Context) error LookupAuthOa2tokenByID(ctx context.Context, id uint64) (*systemType.AuthOa2token, error) @@ -195,6 +203,7 @@ type ( UpdateAuthSession(ctx context.Context, rr ...*systemType.AuthSession) error UpsertAuthSession(ctx context.Context, rr ...*systemType.AuthSession) error DeleteAuthSession(ctx context.Context, rr ...*systemType.AuthSession) error + DeleteAuthSessionByID(ctx context.Context, id string) error TruncateAuthSessions(ctx context.Context) error LookupAuthSessionByID(ctx context.Context, id string) (*systemType.AuthSession, error) @@ -208,6 +217,7 @@ type ( UpdateAutomationSession(ctx context.Context, rr ...*automationType.Session) error UpsertAutomationSession(ctx context.Context, rr ...*automationType.Session) error DeleteAutomationSession(ctx context.Context, rr ...*automationType.Session) error + DeleteAutomationSessionByID(ctx context.Context, id uint64) error TruncateAutomationSessions(ctx context.Context) error LookupAutomationSessionByID(ctx context.Context, id uint64) (*automationType.Session, error) @@ -219,6 +229,7 @@ type ( UpdateAutomationTrigger(ctx context.Context, rr ...*automationType.Trigger) error UpsertAutomationTrigger(ctx context.Context, rr ...*automationType.Trigger) error DeleteAutomationTrigger(ctx context.Context, rr ...*automationType.Trigger) error + DeleteAutomationTriggerByID(ctx context.Context, id uint64) error TruncateAutomationTriggers(ctx context.Context) error LookupAutomationTriggerByID(ctx context.Context, id uint64) (*automationType.Trigger, error) @@ -230,6 +241,7 @@ type ( UpdateAutomationWorkflow(ctx context.Context, rr ...*automationType.Workflow) error UpsertAutomationWorkflow(ctx context.Context, rr ...*automationType.Workflow) error DeleteAutomationWorkflow(ctx context.Context, rr ...*automationType.Workflow) error + DeleteAutomationWorkflowByID(ctx context.Context, id uint64) error TruncateAutomationWorkflows(ctx context.Context) error LookupAutomationWorkflowByID(ctx context.Context, id uint64) (*automationType.Workflow, error) @@ -242,6 +254,7 @@ type ( UpdateComposeAttachment(ctx context.Context, rr ...*composeType.Attachment) error UpsertComposeAttachment(ctx context.Context, rr ...*composeType.Attachment) error DeleteComposeAttachment(ctx context.Context, rr ...*composeType.Attachment) error + DeleteComposeAttachmentByID(ctx context.Context, id uint64) error TruncateComposeAttachments(ctx context.Context) error LookupComposeAttachmentByID(ctx context.Context, id uint64) (*composeType.Attachment, error) @@ -253,6 +266,7 @@ type ( UpdateComposeChart(ctx context.Context, rr ...*composeType.Chart) error UpsertComposeChart(ctx context.Context, rr ...*composeType.Chart) error DeleteComposeChart(ctx context.Context, rr ...*composeType.Chart) error + DeleteComposeChartByID(ctx context.Context, id uint64) error TruncateComposeCharts(ctx context.Context) error LookupComposeChartByID(ctx context.Context, id uint64) (*composeType.Chart, error) @@ -265,6 +279,7 @@ type ( UpdateComposeModule(ctx context.Context, rr ...*composeType.Module) error UpsertComposeModule(ctx context.Context, rr ...*composeType.Module) error DeleteComposeModule(ctx context.Context, rr ...*composeType.Module) error + DeleteComposeModuleByID(ctx context.Context, id uint64) error TruncateComposeModules(ctx context.Context) error LookupComposeModuleByNamespaceIDHandle(ctx context.Context, namespaceID uint64, handle string) (*composeType.Module, error) @@ -278,6 +293,7 @@ type ( UpdateComposeModuleField(ctx context.Context, rr ...*composeType.ModuleField) error UpsertComposeModuleField(ctx context.Context, rr ...*composeType.ModuleField) error DeleteComposeModuleField(ctx context.Context, rr ...*composeType.ModuleField) error + DeleteComposeModuleFieldByID(ctx context.Context, id uint64) error TruncateComposeModuleFields(ctx context.Context) error LookupComposeModuleFieldByModuleIDName(ctx context.Context, moduleID uint64, name string) (*composeType.ModuleField, error) @@ -290,6 +306,7 @@ type ( UpdateComposeNamespace(ctx context.Context, rr ...*composeType.Namespace) error UpsertComposeNamespace(ctx context.Context, rr ...*composeType.Namespace) error DeleteComposeNamespace(ctx context.Context, rr ...*composeType.Namespace) error + DeleteComposeNamespaceByID(ctx context.Context, id uint64) error TruncateComposeNamespaces(ctx context.Context) error LookupComposeNamespaceBySlug(ctx context.Context, slug string) (*composeType.Namespace, error) @@ -302,6 +319,7 @@ type ( UpdateComposePage(ctx context.Context, rr ...*composeType.Page) error UpsertComposePage(ctx context.Context, rr ...*composeType.Page) error DeleteComposePage(ctx context.Context, rr ...*composeType.Page) error + DeleteComposePageByID(ctx context.Context, id uint64) error TruncateComposePages(ctx context.Context) error LookupComposePageByNamespaceIDHandle(ctx context.Context, namespaceID uint64, handle string) (*composeType.Page, error) @@ -316,6 +334,7 @@ type ( UpdateCredential(ctx context.Context, rr ...*systemType.Credential) error UpsertCredential(ctx context.Context, rr ...*systemType.Credential) error DeleteCredential(ctx context.Context, rr ...*systemType.Credential) error + DeleteCredentialByID(ctx context.Context, id uint64) error TruncateCredentials(ctx context.Context) error LookupCredentialByID(ctx context.Context, id uint64) (*systemType.Credential, error) @@ -327,6 +346,7 @@ type ( UpdateDalConnection(ctx context.Context, rr ...*systemType.DalConnection) error UpsertDalConnection(ctx context.Context, rr ...*systemType.DalConnection) error DeleteDalConnection(ctx context.Context, rr ...*systemType.DalConnection) error + DeleteDalConnectionByID(ctx context.Context, id uint64) error TruncateDalConnections(ctx context.Context) error LookupDalConnectionByID(ctx context.Context, id uint64) (*systemType.DalConnection, error) @@ -339,6 +359,7 @@ type ( UpdateDalSensitivityLevel(ctx context.Context, rr ...*systemType.DalSensitivityLevel) error UpsertDalSensitivityLevel(ctx context.Context, rr ...*systemType.DalSensitivityLevel) error DeleteDalSensitivityLevel(ctx context.Context, rr ...*systemType.DalSensitivityLevel) error + DeleteDalSensitivityLevelByID(ctx context.Context, id uint64) error TruncateDalSensitivityLevels(ctx context.Context) error LookupDalSensitivityLevelByID(ctx context.Context, id uint64) (*systemType.DalSensitivityLevel, error) @@ -350,6 +371,7 @@ type ( UpdateDataPrivacyRequest(ctx context.Context, rr ...*systemType.DataPrivacyRequest) error UpsertDataPrivacyRequest(ctx context.Context, rr ...*systemType.DataPrivacyRequest) error DeleteDataPrivacyRequest(ctx context.Context, rr ...*systemType.DataPrivacyRequest) error + DeleteDataPrivacyRequestByID(ctx context.Context, id uint64) error TruncateDataPrivacyRequests(ctx context.Context) error LookupDataPrivacyRequestByID(ctx context.Context, id uint64) (*systemType.DataPrivacyRequest, error) @@ -361,6 +383,7 @@ type ( UpdateDataPrivacyRequestComment(ctx context.Context, rr ...*systemType.DataPrivacyRequestComment) error UpsertDataPrivacyRequestComment(ctx context.Context, rr ...*systemType.DataPrivacyRequestComment) error DeleteDataPrivacyRequestComment(ctx context.Context, rr ...*systemType.DataPrivacyRequestComment) error + DeleteDataPrivacyRequestCommentByID(ctx context.Context, id uint64) error TruncateDataPrivacyRequestComments(ctx context.Context) error } @@ -371,6 +394,7 @@ type ( UpdateFederationExposedModule(ctx context.Context, rr ...*federationType.ExposedModule) error UpsertFederationExposedModule(ctx context.Context, rr ...*federationType.ExposedModule) error DeleteFederationExposedModule(ctx context.Context, rr ...*federationType.ExposedModule) error + DeleteFederationExposedModuleByID(ctx context.Context, id uint64) error TruncateFederationExposedModules(ctx context.Context) error LookupFederationExposedModuleByID(ctx context.Context, id uint64) (*federationType.ExposedModule, error) @@ -382,6 +406,7 @@ type ( UpdateFederationModuleMapping(ctx context.Context, rr ...*federationType.ModuleMapping) error UpsertFederationModuleMapping(ctx context.Context, rr ...*federationType.ModuleMapping) error DeleteFederationModuleMapping(ctx context.Context, rr ...*federationType.ModuleMapping) error + DeleteFederationModuleMappingByNodeID(ctx context.Context, nodeID uint64) error TruncateFederationModuleMappings(ctx context.Context) error LookupFederationModuleMappingByFederationModuleIDComposeModuleIDComposeNamespaceID(ctx context.Context, federationModuleID uint64, composeModuleID uint64, composeNamespaceID uint64) (*federationType.ModuleMapping, error) @@ -394,6 +419,7 @@ type ( UpdateFederationNode(ctx context.Context, rr ...*federationType.Node) error UpsertFederationNode(ctx context.Context, rr ...*federationType.Node) error DeleteFederationNode(ctx context.Context, rr ...*federationType.Node) error + DeleteFederationNodeByID(ctx context.Context, id uint64) error TruncateFederationNodes(ctx context.Context) error LookupFederationNodeByID(ctx context.Context, id uint64) (*federationType.Node, error) @@ -407,6 +433,7 @@ type ( UpdateFederationNodeSync(ctx context.Context, rr ...*federationType.NodeSync) error UpsertFederationNodeSync(ctx context.Context, rr ...*federationType.NodeSync) error DeleteFederationNodeSync(ctx context.Context, rr ...*federationType.NodeSync) error + DeleteFederationNodeSyncByNodeID(ctx context.Context, nodeID uint64) error TruncateFederationNodeSyncs(ctx context.Context) error LookupFederationNodeSyncByNodeID(ctx context.Context, nodeID uint64) (*federationType.NodeSync, error) @@ -419,6 +446,7 @@ type ( UpdateFederationSharedModule(ctx context.Context, rr ...*federationType.SharedModule) error UpsertFederationSharedModule(ctx context.Context, rr ...*federationType.SharedModule) error DeleteFederationSharedModule(ctx context.Context, rr ...*federationType.SharedModule) error + DeleteFederationSharedModuleByID(ctx context.Context, id uint64) error TruncateFederationSharedModules(ctx context.Context) error LookupFederationSharedModuleByID(ctx context.Context, id uint64) (*federationType.SharedModule, error) @@ -430,6 +458,7 @@ type ( UpdateFlag(ctx context.Context, rr ...*flagType.Flag) error UpsertFlag(ctx context.Context, rr ...*flagType.Flag) error DeleteFlag(ctx context.Context, rr ...*flagType.Flag) error + DeleteFlagByKindResourceIDOwnedByName(ctx context.Context, kind string, resourceID uint64, ownedBy uint64, name string) error TruncateFlags(ctx context.Context) error LookupFlagByKindResourceIDOwnedByName(ctx context.Context, kind string, resourceID uint64, ownedBy uint64, name string) (*flagType.Flag, error) @@ -441,6 +470,7 @@ type ( UpdateLabel(ctx context.Context, rr ...*labelsType.Label) error UpsertLabel(ctx context.Context, rr ...*labelsType.Label) error DeleteLabel(ctx context.Context, rr ...*labelsType.Label) error + DeleteLabelByKindResourceIDName(ctx context.Context, kind string, resourceID uint64, name string) error TruncateLabels(ctx context.Context) error LookupLabelByKindResourceIDName(ctx context.Context, kind string, resourceID uint64, name string) (*labelsType.Label, error) @@ -453,6 +483,7 @@ type ( UpdateQueue(ctx context.Context, rr ...*systemType.Queue) error UpsertQueue(ctx context.Context, rr ...*systemType.Queue) error DeleteQueue(ctx context.Context, rr ...*systemType.Queue) error + DeleteQueueByID(ctx context.Context, id uint64) error TruncateQueues(ctx context.Context) error LookupQueueByID(ctx context.Context, id uint64) (*systemType.Queue, error) @@ -465,6 +496,7 @@ type ( UpdateQueueMessage(ctx context.Context, rr ...*systemType.QueueMessage) error UpsertQueueMessage(ctx context.Context, rr ...*systemType.QueueMessage) error DeleteQueueMessage(ctx context.Context, rr ...*systemType.QueueMessage) error + DeleteQueueMessageByID(ctx context.Context, id uint64) error TruncateQueueMessages(ctx context.Context) error } @@ -475,6 +507,7 @@ type ( UpdateRbacRule(ctx context.Context, rr ...*rbacType.Rule) error UpsertRbacRule(ctx context.Context, rr ...*rbacType.Rule) error DeleteRbacRule(ctx context.Context, rr ...*rbacType.Rule) error + DeleteRbacRuleByRoleIDResourceOperation(ctx context.Context, roleID uint64, resource string, operation string) error TruncateRbacRules(ctx context.Context) error TransferRbacRules(ctx context.Context, src uint64, dst uint64) error @@ -486,6 +519,7 @@ type ( UpdateReminder(ctx context.Context, rr ...*systemType.Reminder) error UpsertReminder(ctx context.Context, rr ...*systemType.Reminder) error DeleteReminder(ctx context.Context, rr ...*systemType.Reminder) error + DeleteReminderByID(ctx context.Context, id uint64) error TruncateReminders(ctx context.Context) error LookupReminderByID(ctx context.Context, id uint64) (*systemType.Reminder, error) @@ -497,6 +531,7 @@ type ( UpdateReport(ctx context.Context, rr ...*systemType.Report) error UpsertReport(ctx context.Context, rr ...*systemType.Report) error DeleteReport(ctx context.Context, rr ...*systemType.Report) error + DeleteReportByID(ctx context.Context, id uint64) error TruncateReports(ctx context.Context) error LookupReportByID(ctx context.Context, id uint64) (*systemType.Report, error) @@ -509,6 +544,7 @@ type ( UpdateResourceActivity(ctx context.Context, rr ...*discoveryType.ResourceActivity) error UpsertResourceActivity(ctx context.Context, rr ...*discoveryType.ResourceActivity) error DeleteResourceActivity(ctx context.Context, rr ...*discoveryType.ResourceActivity) error + DeleteResourceActivityByID(ctx context.Context, id uint64) error TruncateResourceActivitys(ctx context.Context) error } @@ -519,6 +555,7 @@ type ( UpdateResourceTranslation(ctx context.Context, rr ...*systemType.ResourceTranslation) error UpsertResourceTranslation(ctx context.Context, rr ...*systemType.ResourceTranslation) error DeleteResourceTranslation(ctx context.Context, rr ...*systemType.ResourceTranslation) error + DeleteResourceTranslationByID(ctx context.Context, id uint64) error TruncateResourceTranslations(ctx context.Context) error LookupResourceTranslationByID(ctx context.Context, id uint64) (*systemType.ResourceTranslation, error) @@ -531,6 +568,7 @@ type ( UpdateRole(ctx context.Context, rr ...*systemType.Role) error UpsertRole(ctx context.Context, rr ...*systemType.Role) error DeleteRole(ctx context.Context, rr ...*systemType.Role) error + DeleteRoleByID(ctx context.Context, id uint64) error TruncateRoles(ctx context.Context) error LookupRoleByID(ctx context.Context, id uint64) (*systemType.Role, error) @@ -545,6 +583,7 @@ type ( UpdateRoleMember(ctx context.Context, rr ...*systemType.RoleMember) error UpsertRoleMember(ctx context.Context, rr ...*systemType.RoleMember) error DeleteRoleMember(ctx context.Context, rr ...*systemType.RoleMember) error + DeleteRoleMemberByUserIDRoleID(ctx context.Context, userID uint64, roleID uint64) error TruncateRoleMembers(ctx context.Context) error TransferRoleMembers(ctx context.Context, src uint64, dst uint64) error @@ -556,6 +595,7 @@ type ( UpdateSettingValue(ctx context.Context, rr ...*systemType.SettingValue) error UpsertSettingValue(ctx context.Context, rr ...*systemType.SettingValue) error DeleteSettingValue(ctx context.Context, rr ...*systemType.SettingValue) error + DeleteSettingValueByOwnedByName(ctx context.Context, ownedBy uint64, name string) error TruncateSettingValues(ctx context.Context) error LookupSettingValueByNameOwnedBy(ctx context.Context, name string, ownedBy uint64) (*systemType.SettingValue, error) @@ -567,6 +607,7 @@ type ( UpdateTemplate(ctx context.Context, rr ...*systemType.Template) error UpsertTemplate(ctx context.Context, rr ...*systemType.Template) error DeleteTemplate(ctx context.Context, rr ...*systemType.Template) error + DeleteTemplateByID(ctx context.Context, id uint64) error TruncateTemplates(ctx context.Context) error LookupTemplateByID(ctx context.Context, id uint64) (*systemType.Template, error) @@ -579,6 +620,7 @@ type ( UpdateUser(ctx context.Context, rr ...*systemType.User) error UpsertUser(ctx context.Context, rr ...*systemType.User) error DeleteUser(ctx context.Context, rr ...*systemType.User) error + DeleteUserByID(ctx context.Context, id uint64) error TruncateUsers(ctx context.Context) error LookupUserByID(ctx context.Context, id uint64) (*systemType.User, error) diff --git a/system/model/models.gen.go b/system/model/models.gen.go index 66b835acb..1f4d1242a 100644 --- a/system/model/models.gen.go +++ b/system/model/models.gen.go @@ -2220,7 +2220,6 @@ var SettingValue = &dal.Model{ { AttributeIdent: "Name", - Modifiers: []dal.IndexFieldModifier{"LOWERCASE"}, }, }, }, diff --git a/system/settings.cue b/system/settings.cue index 81955bfb9..d66777dd1 100644 --- a/system/settings.cue +++ b/system/settings.cue @@ -39,7 +39,7 @@ settings: { "primary": { fields: [ { attribute: "owned_by" }, - { attribute: "name", modifiers: [ "LOWERCASE" ] }, + { attribute: "name" }, ] } }