diff --git a/app/resources.cue b/app/resources.cue index 3b17643d7..2086d39a6 100644 --- a/app/resources.cue +++ b/app/resources.cue @@ -102,6 +102,7 @@ resources: { [key=_]: {"handle": key, "component": "system", "platform": "cortez } indexes: { + "primary": { attributes: ["kind", "resource_id", "name"] } "unique_kind_res_name": { fields: [ { attribute: "kind" }, @@ -185,6 +186,7 @@ resources: { [key=_]: {"handle": key, "component": "system", "platform": "cortez } indexes: { + "primary": { attributes: ["kind", "resource_id", "owned_by", "name"] } "unique_kind_res_owner_name": { fields: [ { attribute: "kind" }, diff --git a/codegen/assets/templates/gocode/store/interfaces.go.tpl b/codegen/assets/templates/gocode/store/interfaces.go.tpl index dfd9d0420..18f9a4259 100644 --- a/codegen/assets/templates/gocode/store/interfaces.go.tpl +++ b/codegen/assets/templates/gocode/store/interfaces.go.tpl @@ -54,7 +54,7 @@ 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 - {{ .api.deleteByPK.expFnIdent }}(ctx context.Context, {{ template "extraArgs" .ident }} {{ range .api.deleteByPK.primaryKeys }}{{ .ident }} {{ .goType }},{{ end }}) error + {{ .api.deleteByPK.expFnIdent }}(ctx context.Context, {{ template "extraArgs" .ident }} {{ range .api.deleteByPK.attributes }}{{ .ident }} {{ .goType }},{{ end }}) error Truncate{{ .expIdentPlural }}(ctx context.Context, {{ template "extraArgs" .ident }}) error {{- range .api.lookups }} @@ -106,8 +106,8 @@ type ( // 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.primaryKeys }}{{ .ident }} {{ .goType }},{{ end }}) error { - return s.{{ .api.deleteByPK.expFnIdent }}(ctx, {{ template "extraParams" .ident }}{{ range .api.deleteByPK.primaryKeys }}{{ .ident }},{{ end }}) + 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 }}) } // Truncate{{ .expIdentPlural }} Deletes all {{ .expIdentPlural }} from store diff --git a/codegen/assets/templates/gocode/store/rdbms/rdbms.go.tpl b/codegen/assets/templates/gocode/store/rdbms/rdbms.go.tpl index 5f76c8822..8244f3bba 100644 --- a/codegen/assets/templates/gocode/store/rdbms/rdbms.go.tpl +++ b/codegen/assets/templates/gocode/store/rdbms/rdbms.go.tpl @@ -103,9 +103,9 @@ func (s *Store) Delete{{ .expIdent }}(ctx context.Context, {{ template "extraArg // Delete{{ .expIdent }}ByID 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.primaryKeys }}{{ .ident }} {{ .goType }},{{ end }}) error { +func (s *Store) {{ .api.deleteByPK.expFnIdent }}(ctx context.Context, {{ template "extraArgs" .ident }} {{ range .api.deleteByPK.attributes }}{{ .ident }} {{ .goType }},{{ end }}) error { return s.Exec(ctx, {{ .ident }}DeleteQuery(s.Dialect, goqu.Ex{ - {{- range .api.deleteByPK.primaryKeys }} + {{- range .api.deleteByPK.attributes }} {{ printf "%q" .storeIdent }}: {{ .ident }}, {{- end }} })) diff --git a/codegen/server.store.cue b/codegen/server.store.cue index c22a63aa6..e15118052 100644 --- a/codegen/server.store.cue +++ b/codegen/server.store.cue @@ -7,10 +7,22 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) + _StoreResource: { res = "res": schema.#Resource typePkg = "typePkg": string + + pkAttrNames: [string, ...] + + if res.model.indexes.primary != _|_ { + // primary key flag is no longer explicitly set on + // the attribute but via model.indexes.primary + pkAttrNames: [ + for f in res.model.indexes.primary.fields { f.attribute } + ] + } + result: { ident: res.store.ident identPlural: res.store.identPlural @@ -22,31 +34,31 @@ _StoreResource: { goFilterType: "\(typePkg).\(res.filter.expIdent)" - struct: [ for f in res.model.attributes if f.store { - "ident": f.ident - "expIdent": f.expIdent - "storeIdent": f.storeIdent - "name": f.name - "primaryKey": f.primaryKey - "ignoreCase": f.ignoreCase - "goType": strings.Replace(f.goType, "types.", "\(typePkg).", 1) + struct: [ for attr in res.model.attributes if attr.store { + "ident": attr.ident + "expIdent": attr.expIdent + "storeIdent": attr.storeIdent + "name": attr.name + "primaryKey": list.Contains(pkAttrNames, attr.name) + "ignoreCase": attr.ignoreCase + "goType": strings.Replace(attr.goType, "types.", "\(typePkg).", 1) }] filter: { // query fields as defined in struct - "query": [ for name in res.filter.query {res.model.attributes[name]}], + "query": [ for name in res.filter.query {res.model.attributes[name]}], // filter by nil state as defined in filter - "byNilState": [ for name in res.filter.byNilState {res.filter.struct[name]}] + "byNilState": [ for name in res.filter.byNilState {res.filter.struct[name]}] // filter by false as defined in filter "byFalseState": [ for name in res.filter.byFalseState {res.filter.struct[name]}] // filter by value as defined in filter // @todo this should be pulled from the struct - "byValue": [ for name in res.filter.byValue {res.filter.struct[name]}] - "byLabel": res.features.labels - "byFlag": res.features.flags + "byValue": [ for name in res.filter.byValue {res.filter.struct[name]}] + "byLabel": res.features.labels + "byFlag": res.features.flags } auxIdent: "aux\(expIdent)" @@ -69,9 +81,9 @@ _StoreResource: { } deleteByPK: { - primaryKeys: [ for f in res.model.attributes if f.primaryKey {f} ] - _pkExpNames: strings.Join([ for f in primaryKeys { f.expIdent } ], "") - "expFnIdent": "Delete\(res.store.expIdent)By\(_pkExpNames)" + 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: [ @@ -87,12 +99,12 @@ _StoreResource: { // Copy all relevant fields from the struct "args": [ for name in l.fields { - let f = res.model.attributes[name] + let attr = res.model.attributes[name] - "ident": f.ident - "storeIdent": f.storeIdent - "goType": f.goType - "ignoreCase": f.ignoreCase + "ident": attr.ident + "storeIdent": attr.storeIdent + "goType": attr.goType + "ignoreCase": attr.ignoreCase }, ] @@ -128,10 +140,10 @@ _StoreResource: { "fnIdent": "sortable\(expIdent)Fields" fields: { - for f in res.model.attributes if f.sortable || f.unique || f.primaryKey { + for attr in res.model.attributes if attr.sortable || attr.unique || list.Contains(pkAttrNames, attr.name) { { - "\(strings.ToLower(f.name))": f.name - "\(strings.ToLower(f.ident))": f.name + "\(strings.ToLower(attr.name))": attr.name + "\(strings.ToLower(attr.ident))": attr.name } } } @@ -142,8 +154,12 @@ _StoreResource: { "fnIdent": "collect\(expIdent)CursorValues" - fields: [ for f in res.model.attributes if f.sortable || f.unique || f.primaryKey {f} ] - primaryKeys: [ for f in res.model.attributes if f.primaryKey {f} ] + fields: [ for attr in res.model.attributes if attr.sortable || attr.unique || list.Contains(pkAttrNames, attr.name) { + attr + "primaryKey": list.Contains(pkAttrNames, attr.name) + } ] + + primaryKeys: [ for attr in res.model.attributes if list.Contains(pkAttrNames, attr.name) {attr} ] } checkConstraints: { diff --git a/federation/module_mapping.cue b/federation/module_mapping.cue index 6967061a6..4cb14870d 100644 --- a/federation/module_mapping.cue +++ b/federation/module_mapping.cue @@ -13,9 +13,10 @@ moduleMapping: { ident: "federation_module_mapping" attributes: { node_id: { - ident: "nodeID", - goType: "uint64", - unique: true + ident: "nodeID" + unique: true + goType: "uint64" + dal: { type: "ID" } } federation_module_id: { sortable: true, @@ -42,6 +43,7 @@ moduleMapping: { } indexes: { + "primary": { attribute: "node_id" } "unique_module_compose_module": { attributes: ["federation_module_id", "compose_module_id", "compose_namespace_id" ] } diff --git a/federation/node_sync.cue b/federation/node_sync.cue index 2fa1e1701..fa5375b16 100644 --- a/federation/node_sync.cue +++ b/federation/node_sync.cue @@ -36,6 +36,10 @@ nodeSync: { } time_of_action: schema.SortableTimestampField } + + indexes: { + "primary": { attribute: "node_id" } + } } filter: { diff --git a/store/adapters/rdbms/aux_types.gen.go b/store/adapters/rdbms/aux_types.gen.go index 7fe46ee24..f5f5beb4f 100644 --- a/store/adapters/rdbms/aux_types.gen.go +++ b/store/adapters/rdbms/aux_types.gen.go @@ -139,8 +139,8 @@ type ( UserAgent string `db:"user_agent"` ClientID uint64 `db:"client_id"` UserID uint64 `db:"user_id"` - ExpiresAt time.Time `db:"expires_at"` CreatedAt time.Time `db:"created_at"` + ExpiresAt time.Time `db:"expires_at"` } // auxAuthSession is an auxiliary structure used for transporting to/from RDBMS store @@ -158,17 +158,17 @@ type ( auxAutomationSession struct { ID uint64 `db:"id"` WorkflowID uint64 `db:"workflow_id"` + Status automationType.SessionStatus `db:"status"` EventType string `db:"event_type"` ResourceType string `db:"resource_type"` - Status automationType.SessionStatus `db:"status"` Input *expr.Vars `db:"input"` Output *expr.Vars `db:"output"` Stacktrace automationType.Stacktrace `db:"stacktrace"` CreatedBy uint64 `db:"created_by"` CreatedAt time.Time `db:"created_at"` PurgeAt *time.Time `db:"purge_at"` - CompletedAt *time.Time `db:"completed_at"` SuspendedAt *time.Time `db:"suspended_at"` + CompletedAt *time.Time `db:"completed_at"` Error string `db:"error"` } @@ -178,15 +178,15 @@ type ( WorkflowID uint64 `db:"workflow_id"` StepID uint64 `db:"step_id"` Enabled bool `db:"enabled"` + Meta *automationType.TriggerMeta `db:"meta"` ResourceType string `db:"resource_type"` EventType string `db:"event_type"` - Meta *automationType.TriggerMeta `db:"meta"` Constraints automationType.TriggerConstraintSet `db:"constraints"` Input *expr.Vars `db:"input"` + OwnedBy uint64 `db:"owned_by"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` DeletedAt *time.Time `db:"deleted_at"` - OwnedBy uint64 `db:"owned_by"` CreatedBy uint64 `db:"created_by"` UpdatedBy uint64 `db:"updated_by"` DeletedBy uint64 `db:"deleted_by"` @@ -205,10 +205,10 @@ type ( Paths automationType.WorkflowPathSet `db:"paths"` Issues automationType.WorkflowIssueSet `db:"issues"` RunAs uint64 `db:"run_as"` + OwnedBy uint64 `db:"owned_by"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` DeletedAt *time.Time `db:"deleted_at"` - OwnedBy uint64 `db:"owned_by"` CreatedBy uint64 `db:"created_by"` UpdatedBy uint64 `db:"updated_by"` DeletedBy uint64 `db:"deleted_by"` @@ -217,8 +217,8 @@ type ( // auxComposeAttachment is an auxiliary structure used for transporting to/from RDBMS store auxComposeAttachment struct { ID uint64 `db:"id"` - OwnerID uint64 `db:"owner_id"` NamespaceID uint64 `db:"namespace_id"` + OwnerID uint64 `db:"owner_id"` Kind string `db:"kind"` Url string `db:"url"` PreviewUrl string `db:"preview_url"` @@ -233,9 +233,9 @@ type ( auxComposeChart struct { ID uint64 `db:"id"` Handle string `db:"handle"` + NamespaceID uint64 `db:"namespace_id"` Name string `db:"name"` Config composeType.ChartConfig `db:"config"` - NamespaceID uint64 `db:"namespace_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` DeletedAt *time.Time `db:"deleted_at"` @@ -244,11 +244,11 @@ type ( // auxComposeModule is an auxiliary structure used for transporting to/from RDBMS store auxComposeModule struct { ID uint64 `db:"id"` + NamespaceID uint64 `db:"namespace_id"` Handle string `db:"handle"` + Name string `db:"name"` Meta rawJson `db:"meta"` Config composeType.ModuleConfig `db:"config"` - NamespaceID uint64 `db:"namespace_id"` - Name string `db:"name"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` DeletedAt *time.Time `db:"deleted_at"` @@ -260,9 +260,9 @@ type ( ModuleID uint64 `db:"module_id"` Place int `db:"place"` Kind string `db:"kind"` + Options composeType.ModuleFieldOptions `db:"options"` Name string `db:"name"` Label string `db:"label"` - Options composeType.ModuleFieldOptions `db:"options"` Config composeType.ModuleFieldConfig `db:"config"` Required bool `db:"required"` Multi bool `db:"multi"` @@ -288,15 +288,15 @@ type ( // auxComposePage is an auxiliary structure used for transporting to/from RDBMS store auxComposePage struct { ID uint64 `db:"id"` + Title string `db:"title"` + Handle string `db:"handle"` SelfID uint64 `db:"self_id"` ModuleID uint64 `db:"module_id"` NamespaceID uint64 `db:"namespace_id"` - Handle string `db:"handle"` Config composeType.PageConfig `db:"config"` Blocks composeType.PageBlocks `db:"blocks"` Visible bool `db:"visible"` Weight int `db:"weight"` - Title string `db:"title"` Description string `db:"description"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` @@ -407,8 +407,8 @@ type ( // auxFederationNode is an auxiliary structure used for transporting to/from RDBMS store auxFederationNode struct { ID uint64 `db:"id"` - Name string `db:"name"` SharedNodeID uint64 `db:"shared_node_id"` + Name string `db:"name"` BaseURL string `db:"base_url"` Status string `db:"status"` Contact string `db:"contact"` @@ -483,8 +483,8 @@ type ( ID uint64 `db:"id"` Queue string `db:"queue"` Payload []byte `db:"payload"` - Processed *time.Time `db:"processed"` Created *time.Time `db:"created"` + Processed *time.Time `db:"processed"` } // auxRbacRule is an auxiliary structure used for transporting to/from RDBMS store @@ -1023,8 +1023,8 @@ func (aux *auxAuthOa2token) encode(res *systemType.AuthOa2token) (_ error) { aux.UserAgent = res.UserAgent aux.ClientID = res.ClientID aux.UserID = res.UserID - aux.ExpiresAt = res.ExpiresAt aux.CreatedAt = res.CreatedAt + aux.ExpiresAt = res.ExpiresAt return } @@ -1042,8 +1042,8 @@ func (aux auxAuthOa2token) decode() (res *systemType.AuthOa2token, _ error) { res.UserAgent = aux.UserAgent res.ClientID = aux.ClientID res.UserID = aux.UserID - res.ExpiresAt = aux.ExpiresAt res.CreatedAt = aux.CreatedAt + res.ExpiresAt = aux.ExpiresAt return } @@ -1061,8 +1061,8 @@ func (aux *auxAuthOa2token) scan(row scanner) error { &aux.UserAgent, &aux.ClientID, &aux.UserID, - &aux.ExpiresAt, &aux.CreatedAt, + &aux.ExpiresAt, ) } @@ -1116,17 +1116,17 @@ func (aux *auxAuthSession) scan(row scanner) error { func (aux *auxAutomationSession) encode(res *automationType.Session) (_ error) { aux.ID = res.ID aux.WorkflowID = res.WorkflowID + aux.Status = res.Status aux.EventType = res.EventType aux.ResourceType = res.ResourceType - aux.Status = res.Status aux.Input = res.Input aux.Output = res.Output aux.Stacktrace = res.Stacktrace aux.CreatedBy = res.CreatedBy aux.CreatedAt = res.CreatedAt aux.PurgeAt = res.PurgeAt - aux.CompletedAt = res.CompletedAt aux.SuspendedAt = res.SuspendedAt + aux.CompletedAt = res.CompletedAt aux.Error = res.Error return } @@ -1138,17 +1138,17 @@ func (aux auxAutomationSession) decode() (res *automationType.Session, _ error) res = new(automationType.Session) res.ID = aux.ID res.WorkflowID = aux.WorkflowID + res.Status = aux.Status res.EventType = aux.EventType res.ResourceType = aux.ResourceType - res.Status = aux.Status res.Input = aux.Input res.Output = aux.Output res.Stacktrace = aux.Stacktrace res.CreatedBy = aux.CreatedBy res.CreatedAt = aux.CreatedAt res.PurgeAt = aux.PurgeAt - res.CompletedAt = aux.CompletedAt res.SuspendedAt = aux.SuspendedAt + res.CompletedAt = aux.CompletedAt res.Error = aux.Error return } @@ -1160,17 +1160,17 @@ func (aux *auxAutomationSession) scan(row scanner) error { return row.Scan( &aux.ID, &aux.WorkflowID, + &aux.Status, &aux.EventType, &aux.ResourceType, - &aux.Status, &aux.Input, &aux.Output, &aux.Stacktrace, &aux.CreatedBy, &aux.CreatedAt, &aux.PurgeAt, - &aux.CompletedAt, &aux.SuspendedAt, + &aux.CompletedAt, &aux.Error, ) } @@ -1183,15 +1183,15 @@ func (aux *auxAutomationTrigger) encode(res *automationType.Trigger) (_ error) { aux.WorkflowID = res.WorkflowID aux.StepID = res.StepID aux.Enabled = res.Enabled + aux.Meta = res.Meta aux.ResourceType = res.ResourceType aux.EventType = res.EventType - aux.Meta = res.Meta aux.Constraints = res.Constraints aux.Input = res.Input + aux.OwnedBy = res.OwnedBy aux.CreatedAt = res.CreatedAt aux.UpdatedAt = res.UpdatedAt aux.DeletedAt = res.DeletedAt - aux.OwnedBy = res.OwnedBy aux.CreatedBy = res.CreatedBy aux.UpdatedBy = res.UpdatedBy aux.DeletedBy = res.DeletedBy @@ -1207,15 +1207,15 @@ func (aux auxAutomationTrigger) decode() (res *automationType.Trigger, _ error) res.WorkflowID = aux.WorkflowID res.StepID = aux.StepID res.Enabled = aux.Enabled + res.Meta = aux.Meta res.ResourceType = aux.ResourceType res.EventType = aux.EventType - res.Meta = aux.Meta res.Constraints = aux.Constraints res.Input = aux.Input + res.OwnedBy = aux.OwnedBy res.CreatedAt = aux.CreatedAt res.UpdatedAt = aux.UpdatedAt res.DeletedAt = aux.DeletedAt - res.OwnedBy = aux.OwnedBy res.CreatedBy = aux.CreatedBy res.UpdatedBy = aux.UpdatedBy res.DeletedBy = aux.DeletedBy @@ -1231,15 +1231,15 @@ func (aux *auxAutomationTrigger) scan(row scanner) error { &aux.WorkflowID, &aux.StepID, &aux.Enabled, + &aux.Meta, &aux.ResourceType, &aux.EventType, - &aux.Meta, &aux.Constraints, &aux.Input, + &aux.OwnedBy, &aux.CreatedAt, &aux.UpdatedAt, &aux.DeletedAt, - &aux.OwnedBy, &aux.CreatedBy, &aux.UpdatedBy, &aux.DeletedBy, @@ -1261,10 +1261,10 @@ func (aux *auxAutomationWorkflow) encode(res *automationType.Workflow) (_ error) aux.Paths = res.Paths aux.Issues = res.Issues aux.RunAs = res.RunAs + aux.OwnedBy = res.OwnedBy aux.CreatedAt = res.CreatedAt aux.UpdatedAt = res.UpdatedAt aux.DeletedAt = res.DeletedAt - aux.OwnedBy = res.OwnedBy aux.CreatedBy = res.CreatedBy aux.UpdatedBy = res.UpdatedBy aux.DeletedBy = res.DeletedBy @@ -1287,10 +1287,10 @@ func (aux auxAutomationWorkflow) decode() (res *automationType.Workflow, _ error res.Paths = aux.Paths res.Issues = aux.Issues res.RunAs = aux.RunAs + res.OwnedBy = aux.OwnedBy res.CreatedAt = aux.CreatedAt res.UpdatedAt = aux.UpdatedAt res.DeletedAt = aux.DeletedAt - res.OwnedBy = aux.OwnedBy res.CreatedBy = aux.CreatedBy res.UpdatedBy = aux.UpdatedBy res.DeletedBy = aux.DeletedBy @@ -1313,10 +1313,10 @@ func (aux *auxAutomationWorkflow) scan(row scanner) error { &aux.Paths, &aux.Issues, &aux.RunAs, + &aux.OwnedBy, &aux.CreatedAt, &aux.UpdatedAt, &aux.DeletedAt, - &aux.OwnedBy, &aux.CreatedBy, &aux.UpdatedBy, &aux.DeletedBy, @@ -1328,8 +1328,8 @@ func (aux *auxAutomationWorkflow) scan(row scanner) error { // This function is auto-generated func (aux *auxComposeAttachment) encode(res *composeType.Attachment) (_ error) { aux.ID = res.ID - aux.OwnerID = res.OwnerID aux.NamespaceID = res.NamespaceID + aux.OwnerID = res.OwnerID aux.Kind = res.Kind aux.Url = res.Url aux.PreviewUrl = res.PreviewUrl @@ -1347,8 +1347,8 @@ func (aux *auxComposeAttachment) encode(res *composeType.Attachment) (_ error) { func (aux auxComposeAttachment) decode() (res *composeType.Attachment, _ error) { res = new(composeType.Attachment) res.ID = aux.ID - res.OwnerID = aux.OwnerID res.NamespaceID = aux.NamespaceID + res.OwnerID = aux.OwnerID res.Kind = aux.Kind res.Url = aux.Url res.PreviewUrl = aux.PreviewUrl @@ -1366,8 +1366,8 @@ func (aux auxComposeAttachment) decode() (res *composeType.Attachment, _ error) func (aux *auxComposeAttachment) scan(row scanner) error { return row.Scan( &aux.ID, - &aux.OwnerID, &aux.NamespaceID, + &aux.OwnerID, &aux.Kind, &aux.Url, &aux.PreviewUrl, @@ -1385,9 +1385,9 @@ func (aux *auxComposeAttachment) scan(row scanner) error { func (aux *auxComposeChart) encode(res *composeType.Chart) (_ error) { aux.ID = res.ID aux.Handle = res.Handle + aux.NamespaceID = res.NamespaceID aux.Name = res.Name aux.Config = res.Config - aux.NamespaceID = res.NamespaceID aux.CreatedAt = res.CreatedAt aux.UpdatedAt = res.UpdatedAt aux.DeletedAt = res.DeletedAt @@ -1401,9 +1401,9 @@ func (aux auxComposeChart) decode() (res *composeType.Chart, _ error) { res = new(composeType.Chart) res.ID = aux.ID res.Handle = aux.Handle + res.NamespaceID = aux.NamespaceID res.Name = aux.Name res.Config = aux.Config - res.NamespaceID = aux.NamespaceID res.CreatedAt = aux.CreatedAt res.UpdatedAt = aux.UpdatedAt res.DeletedAt = aux.DeletedAt @@ -1417,9 +1417,9 @@ func (aux *auxComposeChart) scan(row scanner) error { return row.Scan( &aux.ID, &aux.Handle, + &aux.NamespaceID, &aux.Name, &aux.Config, - &aux.NamespaceID, &aux.CreatedAt, &aux.UpdatedAt, &aux.DeletedAt, @@ -1431,11 +1431,11 @@ func (aux *auxComposeChart) scan(row scanner) error { // This function is auto-generated func (aux *auxComposeModule) encode(res *composeType.Module) (_ error) { aux.ID = res.ID + aux.NamespaceID = res.NamespaceID aux.Handle = res.Handle + aux.Name = res.Name aux.Meta = res.Meta aux.Config = res.Config - aux.NamespaceID = res.NamespaceID - aux.Name = res.Name aux.CreatedAt = res.CreatedAt aux.UpdatedAt = res.UpdatedAt aux.DeletedAt = res.DeletedAt @@ -1448,11 +1448,11 @@ func (aux *auxComposeModule) encode(res *composeType.Module) (_ error) { func (aux auxComposeModule) decode() (res *composeType.Module, _ error) { res = new(composeType.Module) res.ID = aux.ID + res.NamespaceID = aux.NamespaceID res.Handle = aux.Handle + res.Name = aux.Name res.Meta = aux.Meta res.Config = aux.Config - res.NamespaceID = aux.NamespaceID - res.Name = aux.Name res.CreatedAt = aux.CreatedAt res.UpdatedAt = aux.UpdatedAt res.DeletedAt = aux.DeletedAt @@ -1465,11 +1465,11 @@ func (aux auxComposeModule) decode() (res *composeType.Module, _ error) { func (aux *auxComposeModule) scan(row scanner) error { return row.Scan( &aux.ID, + &aux.NamespaceID, &aux.Handle, + &aux.Name, &aux.Meta, &aux.Config, - &aux.NamespaceID, - &aux.Name, &aux.CreatedAt, &aux.UpdatedAt, &aux.DeletedAt, @@ -1484,9 +1484,9 @@ func (aux *auxComposeModuleField) encode(res *composeType.ModuleField) (_ error) aux.ModuleID = res.ModuleID aux.Place = res.Place aux.Kind = res.Kind + aux.Options = res.Options aux.Name = res.Name aux.Label = res.Label - aux.Options = res.Options aux.Config = res.Config aux.Required = res.Required aux.Multi = res.Multi @@ -1507,9 +1507,9 @@ func (aux auxComposeModuleField) decode() (res *composeType.ModuleField, _ error res.ModuleID = aux.ModuleID res.Place = aux.Place res.Kind = aux.Kind + res.Options = aux.Options res.Name = aux.Name res.Label = aux.Label - res.Options = aux.Options res.Config = aux.Config res.Required = aux.Required res.Multi = aux.Multi @@ -1530,9 +1530,9 @@ func (aux *auxComposeModuleField) scan(row scanner) error { &aux.ModuleID, &aux.Place, &aux.Kind, + &aux.Options, &aux.Name, &aux.Label, - &aux.Options, &aux.Config, &aux.Required, &aux.Multi, @@ -1596,15 +1596,15 @@ func (aux *auxComposeNamespace) scan(row scanner) error { // This function is auto-generated func (aux *auxComposePage) encode(res *composeType.Page) (_ error) { aux.ID = res.ID + aux.Title = res.Title + aux.Handle = res.Handle aux.SelfID = res.SelfID aux.ModuleID = res.ModuleID aux.NamespaceID = res.NamespaceID - aux.Handle = res.Handle aux.Config = res.Config aux.Blocks = res.Blocks aux.Visible = res.Visible aux.Weight = res.Weight - aux.Title = res.Title aux.Description = res.Description aux.CreatedAt = res.CreatedAt aux.UpdatedAt = res.UpdatedAt @@ -1618,15 +1618,15 @@ func (aux *auxComposePage) encode(res *composeType.Page) (_ error) { func (aux auxComposePage) decode() (res *composeType.Page, _ error) { res = new(composeType.Page) res.ID = aux.ID + res.Title = aux.Title + res.Handle = aux.Handle res.SelfID = aux.SelfID res.ModuleID = aux.ModuleID res.NamespaceID = aux.NamespaceID - res.Handle = aux.Handle res.Config = aux.Config res.Blocks = aux.Blocks res.Visible = aux.Visible res.Weight = aux.Weight - res.Title = aux.Title res.Description = aux.Description res.CreatedAt = aux.CreatedAt res.UpdatedAt = aux.UpdatedAt @@ -1640,15 +1640,15 @@ func (aux auxComposePage) decode() (res *composeType.Page, _ error) { func (aux *auxComposePage) scan(row scanner) error { return row.Scan( &aux.ID, + &aux.Title, + &aux.Handle, &aux.SelfID, &aux.ModuleID, &aux.NamespaceID, - &aux.Handle, &aux.Config, &aux.Blocks, &aux.Visible, &aux.Weight, - &aux.Title, &aux.Description, &aux.CreatedAt, &aux.UpdatedAt, @@ -2041,8 +2041,8 @@ func (aux *auxFederationModuleMapping) scan(row scanner) error { // This function is auto-generated func (aux *auxFederationNode) encode(res *federationType.Node) (_ error) { aux.ID = res.ID - aux.Name = res.Name aux.SharedNodeID = res.SharedNodeID + aux.Name = res.Name aux.BaseURL = res.BaseURL aux.Status = res.Status aux.Contact = res.Contact @@ -2063,8 +2063,8 @@ func (aux *auxFederationNode) encode(res *federationType.Node) (_ error) { func (aux auxFederationNode) decode() (res *federationType.Node, _ error) { res = new(federationType.Node) res.ID = aux.ID - res.Name = aux.Name res.SharedNodeID = aux.SharedNodeID + res.Name = aux.Name res.BaseURL = aux.BaseURL res.Status = aux.Status res.Contact = aux.Contact @@ -2085,8 +2085,8 @@ func (aux auxFederationNode) decode() (res *federationType.Node, _ error) { func (aux *auxFederationNode) scan(row scanner) error { return row.Scan( &aux.ID, - &aux.Name, &aux.SharedNodeID, + &aux.Name, &aux.BaseURL, &aux.Status, &aux.Contact, @@ -2331,8 +2331,8 @@ func (aux *auxQueueMessage) encode(res *systemType.QueueMessage) (_ error) { aux.ID = res.ID aux.Queue = res.Queue aux.Payload = res.Payload - aux.Processed = res.Processed aux.Created = res.Created + aux.Processed = res.Processed return } @@ -2344,8 +2344,8 @@ func (aux auxQueueMessage) decode() (res *systemType.QueueMessage, _ error) { res.ID = aux.ID res.Queue = aux.Queue res.Payload = aux.Payload - res.Processed = aux.Processed res.Created = aux.Created + res.Processed = aux.Processed return } @@ -2357,8 +2357,8 @@ func (aux *auxQueueMessage) scan(row scanner) error { &aux.ID, &aux.Queue, &aux.Payload, - &aux.Processed, &aux.Created, + &aux.Processed, ) } diff --git a/store/adapters/rdbms/queries.gen.go b/store/adapters/rdbms/queries.gen.go index e5ef48410..54c4cc9bc 100644 --- a/store/adapters/rdbms/queries.gen.go +++ b/store/adapters/rdbms/queries.gen.go @@ -826,8 +826,8 @@ var ( "user_agent", "rel_client", "rel_user", - "expires_at", "created_at", + "expires_at", ).From(authOa2tokenTable) } @@ -846,8 +846,8 @@ var ( "user_agent": res.UserAgent, "rel_client": res.ClientID, "rel_user": res.UserID, - "expires_at": res.ExpiresAt, "created_at": res.CreatedAt, + "expires_at": res.ExpiresAt, }) } @@ -869,8 +869,8 @@ var ( "user_agent": res.UserAgent, "rel_client": res.ClientID, "rel_user": res.UserID, - "expires_at": res.ExpiresAt, "created_at": res.CreatedAt, + "expires_at": res.ExpiresAt, }, ), ) @@ -890,8 +890,8 @@ var ( "user_agent": res.UserAgent, "rel_client": res.ClientID, "rel_user": res.UserID, - "expires_at": res.ExpiresAt, "created_at": res.CreatedAt, + "expires_at": res.ExpiresAt, }). Where(authOa2tokenPrimaryKeys(res)) } @@ -1027,17 +1027,17 @@ var ( return d.Select( "id", "rel_workflow", + "status", "event_type", "resource_type", - "status", "input", "output", "stacktrace", "created_by", "created_at", "purge_at", - "completed_at", "suspended_at", + "completed_at", "error", ).From(automationSessionTable) } @@ -1050,17 +1050,17 @@ var ( Rows(goqu.Record{ "id": res.ID, "rel_workflow": res.WorkflowID, + "status": res.Status, "event_type": res.EventType, "resource_type": res.ResourceType, - "status": res.Status, "input": res.Input, "output": res.Output, "stacktrace": res.Stacktrace, "created_by": res.CreatedBy, "created_at": res.CreatedAt, "purge_at": res.PurgeAt, - "completed_at": res.CompletedAt, "suspended_at": res.SuspendedAt, + "completed_at": res.CompletedAt, "error": res.Error, }) } @@ -1076,17 +1076,17 @@ var ( goqu.DoUpdate(target[1:], goqu.Record{ "rel_workflow": res.WorkflowID, + "status": res.Status, "event_type": res.EventType, "resource_type": res.ResourceType, - "status": res.Status, "input": res.Input, "output": res.Output, "stacktrace": res.Stacktrace, "created_by": res.CreatedBy, "created_at": res.CreatedAt, "purge_at": res.PurgeAt, - "completed_at": res.CompletedAt, "suspended_at": res.SuspendedAt, + "completed_at": res.CompletedAt, "error": res.Error, }, ), @@ -1100,17 +1100,17 @@ var ( return d.Update(automationSessionTable). Set(goqu.Record{ "rel_workflow": res.WorkflowID, + "status": res.Status, "event_type": res.EventType, "resource_type": res.ResourceType, - "status": res.Status, "input": res.Input, "output": res.Output, "stacktrace": res.Stacktrace, "created_by": res.CreatedBy, "created_at": res.CreatedAt, "purge_at": res.PurgeAt, - "completed_at": res.CompletedAt, "suspended_at": res.SuspendedAt, + "completed_at": res.CompletedAt, "error": res.Error, }). Where(automationSessionPrimaryKeys(res)) @@ -1153,15 +1153,15 @@ var ( "rel_workflow", "rel_step", "enabled", + "meta", "resource_type", "event_type", - "meta", "constraints", "input", + "owned_by", "created_at", "updated_at", "deleted_at", - "owned_by", "created_by", "updated_by", "deleted_by", @@ -1178,15 +1178,15 @@ var ( "rel_workflow": res.WorkflowID, "rel_step": res.StepID, "enabled": res.Enabled, + "meta": res.Meta, "resource_type": res.ResourceType, "event_type": res.EventType, - "meta": res.Meta, "constraints": res.Constraints, "input": res.Input, + "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, - "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1206,15 +1206,15 @@ var ( "rel_workflow": res.WorkflowID, "rel_step": res.StepID, "enabled": res.Enabled, + "meta": res.Meta, "resource_type": res.ResourceType, "event_type": res.EventType, - "meta": res.Meta, "constraints": res.Constraints, "input": res.Input, + "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, - "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1232,15 +1232,15 @@ var ( "rel_workflow": res.WorkflowID, "rel_step": res.StepID, "enabled": res.Enabled, + "meta": res.Meta, "resource_type": res.ResourceType, "event_type": res.EventType, - "meta": res.Meta, "constraints": res.Constraints, "input": res.Input, + "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, - "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1292,10 +1292,10 @@ var ( "paths", "issues", "run_as", + "owned_by", "created_at", "updated_at", "deleted_at", - "owned_by", "created_by", "updated_by", "deleted_by", @@ -1319,10 +1319,10 @@ var ( "paths": res.Paths, "issues": res.Issues, "run_as": res.RunAs, + "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, - "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1349,10 +1349,10 @@ var ( "paths": res.Paths, "issues": res.Issues, "run_as": res.RunAs, + "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, - "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1377,10 +1377,10 @@ var ( "paths": res.Paths, "issues": res.Issues, "run_as": res.RunAs, + "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, - "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1422,8 +1422,8 @@ var ( composeAttachmentSelectQuery = func(d goqu.DialectWrapper) *goqu.SelectDataset { return d.Select( "id", - "rel_owner", "rel_namespace", + "rel_owner", "kind", "url", "preview_url", @@ -1442,8 +1442,8 @@ var ( return d.Insert(composeAttachmentTable). Rows(goqu.Record{ "id": res.ID, - "rel_owner": res.OwnerID, "rel_namespace": res.NamespaceID, + "rel_owner": res.OwnerID, "kind": res.Kind, "url": res.Url, "preview_url": res.PreviewUrl, @@ -1465,8 +1465,8 @@ var ( OnConflict( goqu.DoUpdate(target[1:], goqu.Record{ - "rel_owner": res.OwnerID, "rel_namespace": res.NamespaceID, + "rel_owner": res.OwnerID, "kind": res.Kind, "url": res.Url, "preview_url": res.PreviewUrl, @@ -1486,8 +1486,8 @@ var ( composeAttachmentUpdateQuery = func(d goqu.DialectWrapper, res *composeType.Attachment) *goqu.UpdateDataset { return d.Update(composeAttachmentTable). Set(goqu.Record{ - "rel_owner": res.OwnerID, "rel_namespace": res.NamespaceID, + "rel_owner": res.OwnerID, "kind": res.Kind, "url": res.Url, "preview_url": res.PreviewUrl, @@ -1535,9 +1535,9 @@ var ( return d.Select( "id", "handle", + "rel_namespace", "name", "config", - "rel_namespace", "created_at", "updated_at", "deleted_at", @@ -1552,9 +1552,9 @@ var ( Rows(goqu.Record{ "id": res.ID, "handle": res.Handle, + "rel_namespace": res.NamespaceID, "name": res.Name, "config": res.Config, - "rel_namespace": res.NamespaceID, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, @@ -1572,9 +1572,9 @@ var ( goqu.DoUpdate(target[1:], goqu.Record{ "handle": res.Handle, + "rel_namespace": res.NamespaceID, "name": res.Name, "config": res.Config, - "rel_namespace": res.NamespaceID, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, @@ -1590,9 +1590,9 @@ var ( return d.Update(composeChartTable). Set(goqu.Record{ "handle": res.Handle, + "rel_namespace": res.NamespaceID, "name": res.Name, "config": res.Config, - "rel_namespace": res.NamespaceID, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, @@ -1634,11 +1634,11 @@ var ( composeModuleSelectQuery = func(d goqu.DialectWrapper) *goqu.SelectDataset { return d.Select( "id", + "rel_namespace", "handle", + "name", "meta", "config", - "rel_namespace", - "name", "created_at", "updated_at", "deleted_at", @@ -1652,11 +1652,11 @@ var ( return d.Insert(composeModuleTable). Rows(goqu.Record{ "id": res.ID, + "rel_namespace": res.NamespaceID, "handle": res.Handle, + "name": res.Name, "meta": res.Meta, "config": res.Config, - "rel_namespace": res.NamespaceID, - "name": res.Name, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, @@ -1673,11 +1673,11 @@ var ( OnConflict( goqu.DoUpdate(target[1:], goqu.Record{ + "rel_namespace": res.NamespaceID, "handle": res.Handle, + "name": res.Name, "meta": res.Meta, "config": res.Config, - "rel_namespace": res.NamespaceID, - "name": res.Name, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, @@ -1692,11 +1692,11 @@ var ( composeModuleUpdateQuery = func(d goqu.DialectWrapper, res *composeType.Module) *goqu.UpdateDataset { return d.Update(composeModuleTable). Set(goqu.Record{ + "rel_namespace": res.NamespaceID, "handle": res.Handle, + "name": res.Name, "meta": res.Meta, "config": res.Config, - "rel_namespace": res.NamespaceID, - "name": res.Name, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, @@ -1741,9 +1741,9 @@ var ( "rel_module", "place", "kind", + "options", "name", "label", - "options", "config", "is_required", "is_multi", @@ -1765,9 +1765,9 @@ var ( "rel_module": res.ModuleID, "place": res.Place, "kind": res.Kind, + "options": res.Options, "name": res.Name, "label": res.Label, - "options": res.Options, "config": res.Config, "is_required": res.Required, "is_multi": res.Multi, @@ -1792,9 +1792,9 @@ var ( "rel_module": res.ModuleID, "place": res.Place, "kind": res.Kind, + "options": res.Options, "name": res.Name, "label": res.Label, - "options": res.Options, "config": res.Config, "is_required": res.Required, "is_multi": res.Multi, @@ -1817,9 +1817,9 @@ var ( "rel_module": res.ModuleID, "place": res.Place, "kind": res.Kind, + "options": res.Options, "name": res.Name, "label": res.Label, - "options": res.Options, "config": res.Config, "is_required": res.Required, "is_multi": res.Multi, @@ -1966,15 +1966,15 @@ var ( composePageSelectQuery = func(d goqu.DialectWrapper) *goqu.SelectDataset { return d.Select( "id", + "title", + "handle", "self_id", "rel_module", "rel_namespace", - "handle", "config", "blocks", "visible", "weight", - "title", "description", "created_at", "updated_at", @@ -1989,15 +1989,15 @@ var ( return d.Insert(composePageTable). Rows(goqu.Record{ "id": res.ID, + "title": res.Title, + "handle": res.Handle, "self_id": res.SelfID, "rel_module": res.ModuleID, "rel_namespace": res.NamespaceID, - "handle": res.Handle, "config": res.Config, "blocks": res.Blocks, "visible": res.Visible, "weight": res.Weight, - "title": res.Title, "description": res.Description, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, @@ -2015,15 +2015,15 @@ var ( OnConflict( goqu.DoUpdate(target[1:], goqu.Record{ + "title": res.Title, + "handle": res.Handle, "self_id": res.SelfID, "rel_module": res.ModuleID, "rel_namespace": res.NamespaceID, - "handle": res.Handle, "config": res.Config, "blocks": res.Blocks, "visible": res.Visible, "weight": res.Weight, - "title": res.Title, "description": res.Description, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, @@ -2039,15 +2039,15 @@ var ( composePageUpdateQuery = func(d goqu.DialectWrapper, res *composeType.Page) *goqu.UpdateDataset { return d.Update(composePageTable). Set(goqu.Record{ + "title": res.Title, + "handle": res.Handle, "self_id": res.SelfID, "rel_module": res.ModuleID, "rel_namespace": res.NamespaceID, - "handle": res.Handle, "config": res.Config, "blocks": res.Blocks, "visible": res.Visible, "weight": res.Weight, - "title": res.Title, "description": res.Description, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, @@ -2858,8 +2858,8 @@ var ( federationNodeSelectQuery = func(d goqu.DialectWrapper) *goqu.SelectDataset { return d.Select( "id", - "name", "shared_node_id", + "name", "base_url", "status", "contact", @@ -2881,8 +2881,8 @@ var ( return d.Insert(federationNodeTable). Rows(goqu.Record{ "id": res.ID, - "name": res.Name, "shared_node_id": res.SharedNodeID, + "name": res.Name, "base_url": res.BaseURL, "status": res.Status, "contact": res.Contact, @@ -2907,8 +2907,8 @@ var ( OnConflict( goqu.DoUpdate(target[1:], goqu.Record{ - "name": res.Name, "shared_node_id": res.SharedNodeID, + "name": res.Name, "base_url": res.BaseURL, "status": res.Status, "contact": res.Contact, @@ -2931,8 +2931,8 @@ var ( federationNodeUpdateQuery = func(d goqu.DialectWrapper, res *federationType.Node) *goqu.UpdateDataset { return d.Update(federationNodeTable). Set(goqu.Record{ - "name": res.Name, "shared_node_id": res.SharedNodeID, + "name": res.Name, "base_url": res.BaseURL, "status": res.Status, "contact": res.Contact, @@ -3463,8 +3463,8 @@ var ( "id", "queue", "payload", - "processed", "created", + "processed", ).From(queueMessageTable) } @@ -3477,8 +3477,8 @@ var ( "id": res.ID, "queue": res.Queue, "payload": res.Payload, - "processed": res.Processed, "created": res.Created, + "processed": res.Processed, }) } @@ -3494,8 +3494,8 @@ var ( goqu.Record{ "queue": res.Queue, "payload": res.Payload, - "processed": res.Processed, "created": res.Created, + "processed": res.Processed, }, ), ) @@ -3509,8 +3509,8 @@ var ( Set(goqu.Record{ "queue": res.Queue, "payload": res.Payload, - "processed": res.Processed, "created": res.Created, + "processed": res.Processed, }). Where(queueMessagePrimaryKeys(res)) } diff --git a/store/adapters/rdbms/rdbms.gen.go b/store/adapters/rdbms/rdbms.gen.go index 0f36188e1..f1a72e85c 100644 --- a/store/adapters/rdbms/rdbms.gen.go +++ b/store/adapters/rdbms/rdbms.gen.go @@ -3656,10 +3656,10 @@ func (s *Store) collectAuthOa2tokenCursorValues(res *systemType.AuthOa2token, cc case "id": cur.Set(c.Column, res.ID, c.Descending) pkID = true - case "expiresAt": - cur.Set(c.Column, res.ExpiresAt, c.Descending) case "createdAt": cur.Set(c.Column, res.CreatedAt, c.Descending) + case "expiresAt": + cur.Set(c.Column, res.ExpiresAt, c.Descending) } } } @@ -4433,20 +4433,20 @@ func (s *Store) collectAutomationSessionCursorValues(res *automationType.Session pkID = true case "workflowID": cur.Set(c.Column, res.WorkflowID, c.Descending) + case "status": + cur.Set(c.Column, res.Status, c.Descending) case "eventType": cur.Set(c.Column, res.EventType, c.Descending) case "resourceType": cur.Set(c.Column, res.ResourceType, c.Descending) - case "status": - cur.Set(c.Column, res.Status, c.Descending) case "createdAt": cur.Set(c.Column, res.CreatedAt, c.Descending) case "purgeAt": cur.Set(c.Column, res.PurgeAt, c.Descending) - case "completedAt": - cur.Set(c.Column, res.CompletedAt, c.Descending) case "suspendedAt": cur.Set(c.Column, res.SuspendedAt, c.Descending) + case "completedAt": + cur.Set(c.Column, res.CompletedAt, c.Descending) } } } @@ -7428,11 +7428,17 @@ func (s *Store) LookupComposeModuleFieldByID(ctx context.Context, id uint64) (_ // This function is auto-generated func (Store) sortableComposeModuleFieldFields() map[string]string { return map[string]string{ - "id": "id", - "kind": "kind", - "label": "label", - "name": "name", - "place": "place", + "created_at": "created_at", + "createdat": "created_at", + "deleted_at": "deleted_at", + "deletedat": "deleted_at", + "id": "id", + "kind": "kind", + "label": "label", + "name": "name", + "place": "place", + "updated_at": "updated_at", + "updatedat": "updated_at", } } @@ -7469,6 +7475,12 @@ func (s *Store) collectComposeModuleFieldCursorValues(res *composeType.ModuleFie cur.Set(c.Column, res.Name, c.Descending) case "label": cur.Set(c.Column, res.Label, c.Descending) + case "createdAt": + cur.Set(c.Column, res.CreatedAt, c.Descending) + case "updatedAt": + cur.Set(c.Column, res.UpdatedAt, c.Descending) + case "deletedAt": + cur.Set(c.Column, res.DeletedAt, c.Descending) } } } @@ -8626,15 +8638,15 @@ func (s *Store) collectComposePageCursorValues(res *composeType.Page, cc ...*fil case "id": cur.Set(c.Column, res.ID, c.Descending) pkID = true - case "selfID": - cur.Set(c.Column, res.SelfID, c.Descending) + case "title": + cur.Set(c.Column, res.Title, c.Descending) case "handle": cur.Set(c.Column, res.Handle, c.Descending) hasUnique = true + case "selfID": + cur.Set(c.Column, res.SelfID, c.Descending) case "weight": cur.Set(c.Column, res.Weight, c.Descending) - case "title": - cur.Set(c.Column, res.Title, c.Descending) case "createdAt": cur.Set(c.Column, res.CreatedAt, c.Descending) case "updatedAt": @@ -11975,10 +11987,10 @@ func (s *Store) collectFederationNodeCursorValues(res *federationType.Node, cc . case "id": cur.Set(c.Column, res.ID, c.Descending) pkID = true - case "name": - cur.Set(c.Column, res.Name, c.Descending) case "sharedNodeID": cur.Set(c.Column, res.SharedNodeID, c.Descending) + case "name": + cur.Set(c.Column, res.Name, c.Descending) case "baseURL": cur.Set(c.Column, res.BaseURL, c.Descending) case "status": @@ -14580,10 +14592,10 @@ func (s *Store) collectQueueMessageCursorValues(res *systemType.QueueMessage, cc pkID = true case "queue": cur.Set(c.Column, res.Queue, c.Descending) - case "processed": - cur.Set(c.Column, res.Processed, c.Descending) case "created": cur.Set(c.Column, res.Created, c.Descending) + case "processed": + cur.Set(c.Column, res.Processed, c.Descending) } } } @@ -17578,10 +17590,10 @@ func (s *Store) DeleteSettingValue(ctx context.Context, rr ...*systemType.Settin // DeleteSettingValueByID deletes single entry from settingValue collection // // This function is auto-generated -func (s *Store) DeleteSettingValueByOwnedByName(ctx context.Context, ownedBy uint64, name string) error { +func (s *Store) DeleteSettingValueByNameOwnedBy(ctx context.Context, name string, ownedBy uint64) error { return s.Exec(ctx, settingValueDeleteQuery(s.Dialect, goqu.Ex{ - "rel_owner": ownedBy, "name": name, + "rel_owner": ownedBy, })) } diff --git a/store/interfaces.gen.go b/store/interfaces.gen.go index f848246e8..a070eeeec 100644 --- a/store/interfaces.gen.go +++ b/store/interfaces.gen.go @@ -554,7 +554,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 + DeleteSettingValueByNameOwnedBy(ctx context.Context, name string, ownedBy uint64) error TruncateSettingValues(ctx context.Context) error LookupSettingValueByNameOwnedBy(ctx context.Context, name string, ownedBy uint64) (*systemType.SettingValue, error) } @@ -3102,8 +3102,8 @@ func DeleteSettingValue(ctx context.Context, s SettingValues, rr ...*systemType. // DeleteSettingValueByID deletes one or more SettingValues from store // // This function is auto-generated -func DeleteSettingValueByOwnedByName(ctx context.Context, s SettingValues, ownedBy uint64, name string) error { - return s.DeleteSettingValueByOwnedByName(ctx, ownedBy, name) +func DeleteSettingValueByNameOwnedBy(ctx context.Context, s SettingValues, name string, ownedBy uint64) error { + return s.DeleteSettingValueByNameOwnedBy(ctx, name, ownedBy) } // TruncateSettingValues Deletes all SettingValues from store diff --git a/store/tests/all_test.go b/store/tests/all_test.go index 5e50f0d12..570bc33e6 100644 --- a/store/tests/all_test.go +++ b/store/tests/all_test.go @@ -13,6 +13,7 @@ import ( ) func testAllGenerated(t *testing.T, s store.Storer) { + t.Run("actionlog", func(t *testing.T) { testActionlogs(t, s) }) diff --git a/system/auth_session.cue b/system/auth_session.cue index d6fd90d9d..dcacefe50 100644 --- a/system/auth_session.cue +++ b/system/auth_session.cue @@ -14,7 +14,11 @@ auth_session: { model: { attributes: { - id: schema.IdField + id: { + expIdent: "ID", + goType: string + dal: { length: 64 } + } data: { goType: "[]byte" dal: { type: "Blob" } diff --git a/system/settings.cue b/system/settings.cue index 31434d65b..b7e5700c5 100644 --- a/system/settings.cue +++ b/system/settings.cue @@ -36,6 +36,7 @@ settings: { } indexes: { + "primary": { attributes: ["name", "owned_by"] } "unique_kind_res_name": { fields: [ { attribute: "owned_by" },