mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-16 21:58:40 +00:00
feat: chinese-currency (#158)
* run updated code gen * feat: add RMB currency support
This commit is contained in:
parent
e8f215ce34
commit
1dc1ee54e2
42 changed files with 565 additions and 1324 deletions
|
@ -73,11 +73,13 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
|
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||||
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
||||||
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
|
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
@ -89,6 +91,8 @@ github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY=
|
github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY=
|
||||||
github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
|
github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
|
||||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||||
|
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
|
|
@ -255,27 +255,15 @@ func (ac *AttachmentCreate) createSpec() (*Attachment, *sqlgraph.CreateSpec) {
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := ac.mutation.CreatedAt(); ok {
|
if value, ok := ac.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(attachment.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: attachment.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := ac.mutation.UpdatedAt(); ok {
|
if value, ok := ac.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(attachment.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: attachment.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := ac.mutation.GetType(); ok {
|
if value, ok := ac.mutation.GetType(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(attachment.FieldType, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: attachment.FieldType,
|
|
||||||
})
|
|
||||||
_node.Type = value
|
_node.Type = value
|
||||||
}
|
}
|
||||||
if nodes := ac.mutation.ItemIDs(); len(nodes) > 0 {
|
if nodes := ac.mutation.ItemIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -369,6 +369,11 @@ func (aq *AttachmentQuery) Select(fields ...string) *AttachmentSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a AttachmentSelect configured with the given aggregations.
|
||||||
|
func (aq *AttachmentQuery) Aggregate(fns ...AggregateFunc) *AttachmentSelect {
|
||||||
|
return aq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (aq *AttachmentQuery) prepareQuery(ctx context.Context) error {
|
func (aq *AttachmentQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range aq.fields {
|
for _, f := range aq.fields {
|
||||||
if !attachment.ValidColumn(f) {
|
if !attachment.ValidColumn(f) {
|
||||||
|
@ -645,8 +650,6 @@ func (agb *AttachmentGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range agb.fns {
|
for _, fn := range agb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(agb.fields)+len(agb.fns))
|
columns := make([]string, 0, len(agb.fields)+len(agb.fns))
|
||||||
for _, f := range agb.fields {
|
for _, f := range agb.fields {
|
||||||
|
@ -666,6 +669,12 @@ type AttachmentSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (as *AttachmentSelect) Aggregate(fns ...AggregateFunc) *AttachmentSelect {
|
||||||
|
as.fns = append(as.fns, fns...)
|
||||||
|
return as
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (as *AttachmentSelect) Scan(ctx context.Context, v any) error {
|
func (as *AttachmentSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := as.prepareQuery(ctx); err != nil {
|
if err := as.prepareQuery(ctx); err != nil {
|
||||||
|
@ -676,6 +685,16 @@ func (as *AttachmentSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (as *AttachmentSelect) sqlScan(ctx context.Context, v any) error {
|
func (as *AttachmentSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(as.fns))
|
||||||
|
for _, fn := range as.fns {
|
||||||
|
aggregation = append(aggregation, fn(as.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*as.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
as.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
as.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := as.sql.Query()
|
query, args := as.sql.Query()
|
||||||
if err := as.driver.Query(ctx, query, args, rows); err != nil {
|
if err := as.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -194,18 +194,10 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := au.mutation.UpdatedAt(); ok {
|
if value, ok := au.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(attachment.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: attachment.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := au.mutation.GetType(); ok {
|
if value, ok := au.mutation.GetType(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(attachment.FieldType, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: attachment.FieldType,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if au.mutation.ItemCleared() {
|
if au.mutation.ItemCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -489,18 +481,10 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := auo.mutation.UpdatedAt(); ok {
|
if value, ok := auo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(attachment.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: attachment.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := auo.mutation.GetType(); ok {
|
if value, ok := auo.mutation.GetType(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(attachment.FieldType, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: attachment.FieldType,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if auo.mutation.ItemCleared() {
|
if auo.mutation.ItemCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -249,35 +249,19 @@ func (atc *AuthTokensCreate) createSpec() (*AuthTokens, *sqlgraph.CreateSpec) {
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := atc.mutation.CreatedAt(); ok {
|
if value, ok := atc.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := atc.mutation.UpdatedAt(); ok {
|
if value, ok := atc.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := atc.mutation.Token(); ok {
|
if value, ok := atc.mutation.Token(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldToken, field.TypeBytes, value)
|
||||||
Type: field.TypeBytes,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldToken,
|
|
||||||
})
|
|
||||||
_node.Token = value
|
_node.Token = value
|
||||||
}
|
}
|
||||||
if value, ok := atc.mutation.ExpiresAt(); ok {
|
if value, ok := atc.mutation.ExpiresAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldExpiresAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldExpiresAt,
|
|
||||||
})
|
|
||||||
_node.ExpiresAt = value
|
_node.ExpiresAt = value
|
||||||
}
|
}
|
||||||
if nodes := atc.mutation.UserIDs(); len(nodes) > 0 {
|
if nodes := atc.mutation.UserIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -333,6 +333,11 @@ func (atq *AuthTokensQuery) Select(fields ...string) *AuthTokensSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a AuthTokensSelect configured with the given aggregations.
|
||||||
|
func (atq *AuthTokensQuery) Aggregate(fns ...AggregateFunc) *AuthTokensSelect {
|
||||||
|
return atq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (atq *AuthTokensQuery) prepareQuery(ctx context.Context) error {
|
func (atq *AuthTokensQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range atq.fields {
|
for _, f := range atq.fields {
|
||||||
if !authtokens.ValidColumn(f) {
|
if !authtokens.ValidColumn(f) {
|
||||||
|
@ -573,8 +578,6 @@ func (atgb *AuthTokensGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range atgb.fns {
|
for _, fn := range atgb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(atgb.fields)+len(atgb.fns))
|
columns := make([]string, 0, len(atgb.fields)+len(atgb.fns))
|
||||||
for _, f := range atgb.fields {
|
for _, f := range atgb.fields {
|
||||||
|
@ -594,6 +597,12 @@ type AuthTokensSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (ats *AuthTokensSelect) Aggregate(fns ...AggregateFunc) *AuthTokensSelect {
|
||||||
|
ats.fns = append(ats.fns, fns...)
|
||||||
|
return ats
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (ats *AuthTokensSelect) Scan(ctx context.Context, v any) error {
|
func (ats *AuthTokensSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := ats.prepareQuery(ctx); err != nil {
|
if err := ats.prepareQuery(ctx); err != nil {
|
||||||
|
@ -604,6 +613,16 @@ func (ats *AuthTokensSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ats *AuthTokensSelect) sqlScan(ctx context.Context, v any) error {
|
func (ats *AuthTokensSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(ats.fns))
|
||||||
|
for _, fn := range ats.fns {
|
||||||
|
aggregation = append(aggregation, fn(ats.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*ats.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
ats.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
ats.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := ats.sql.Query()
|
query, args := ats.sql.Query()
|
||||||
if err := ats.driver.Query(ctx, query, args, rows); err != nil {
|
if err := ats.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -168,25 +168,13 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := atu.mutation.UpdatedAt(); ok {
|
if value, ok := atu.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := atu.mutation.Token(); ok {
|
if value, ok := atu.mutation.Token(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldToken, field.TypeBytes, value)
|
||||||
Type: field.TypeBytes,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldToken,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := atu.mutation.ExpiresAt(); ok {
|
if value, ok := atu.mutation.ExpiresAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldExpiresAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldExpiresAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if atu.mutation.UserCleared() {
|
if atu.mutation.UserCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -410,25 +398,13 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := atuo.mutation.UpdatedAt(); ok {
|
if value, ok := atuo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := atuo.mutation.Token(); ok {
|
if value, ok := atuo.mutation.Token(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldToken, field.TypeBytes, value)
|
||||||
Type: field.TypeBytes,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldToken,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := atuo.mutation.ExpiresAt(); ok {
|
if value, ok := atuo.mutation.ExpiresAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(authtokens.FieldExpiresAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: authtokens.FieldExpiresAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if atuo.mutation.UserCleared() {
|
if atuo.mutation.UserCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -250,7 +250,7 @@ func (c *AttachmentClient) DeleteOne(a *Attachment) *AttachmentDeleteOne {
|
||||||
return c.DeleteOneID(a.ID)
|
return c.DeleteOneID(a.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *AttachmentClient) DeleteOneID(id uuid.UUID) *AttachmentDeleteOne {
|
func (c *AttachmentClient) DeleteOneID(id uuid.UUID) *AttachmentDeleteOne {
|
||||||
builder := c.Delete().Where(attachment.ID(id))
|
builder := c.Delete().Where(attachment.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -282,7 +282,7 @@ func (c *AttachmentClient) GetX(ctx context.Context, id uuid.UUID) *Attachment {
|
||||||
// QueryItem queries the item edge of a Attachment.
|
// QueryItem queries the item edge of a Attachment.
|
||||||
func (c *AttachmentClient) QueryItem(a *Attachment) *ItemQuery {
|
func (c *AttachmentClient) QueryItem(a *Attachment) *ItemQuery {
|
||||||
query := &ItemQuery{config: c.config}
|
query := &ItemQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := a.ID
|
id := a.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(attachment.Table, attachment.FieldID, id),
|
sqlgraph.From(attachment.Table, attachment.FieldID, id),
|
||||||
|
@ -298,7 +298,7 @@ func (c *AttachmentClient) QueryItem(a *Attachment) *ItemQuery {
|
||||||
// QueryDocument queries the document edge of a Attachment.
|
// QueryDocument queries the document edge of a Attachment.
|
||||||
func (c *AttachmentClient) QueryDocument(a *Attachment) *DocumentQuery {
|
func (c *AttachmentClient) QueryDocument(a *Attachment) *DocumentQuery {
|
||||||
query := &DocumentQuery{config: c.config}
|
query := &DocumentQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := a.ID
|
id := a.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(attachment.Table, attachment.FieldID, id),
|
sqlgraph.From(attachment.Table, attachment.FieldID, id),
|
||||||
|
@ -372,7 +372,7 @@ func (c *AuthTokensClient) DeleteOne(at *AuthTokens) *AuthTokensDeleteOne {
|
||||||
return c.DeleteOneID(at.ID)
|
return c.DeleteOneID(at.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *AuthTokensClient) DeleteOneID(id uuid.UUID) *AuthTokensDeleteOne {
|
func (c *AuthTokensClient) DeleteOneID(id uuid.UUID) *AuthTokensDeleteOne {
|
||||||
builder := c.Delete().Where(authtokens.ID(id))
|
builder := c.Delete().Where(authtokens.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -404,7 +404,7 @@ func (c *AuthTokensClient) GetX(ctx context.Context, id uuid.UUID) *AuthTokens {
|
||||||
// QueryUser queries the user edge of a AuthTokens.
|
// QueryUser queries the user edge of a AuthTokens.
|
||||||
func (c *AuthTokensClient) QueryUser(at *AuthTokens) *UserQuery {
|
func (c *AuthTokensClient) QueryUser(at *AuthTokens) *UserQuery {
|
||||||
query := &UserQuery{config: c.config}
|
query := &UserQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := at.ID
|
id := at.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(authtokens.Table, authtokens.FieldID, id),
|
sqlgraph.From(authtokens.Table, authtokens.FieldID, id),
|
||||||
|
@ -478,7 +478,7 @@ func (c *DocumentClient) DeleteOne(d *Document) *DocumentDeleteOne {
|
||||||
return c.DeleteOneID(d.ID)
|
return c.DeleteOneID(d.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *DocumentClient) DeleteOneID(id uuid.UUID) *DocumentDeleteOne {
|
func (c *DocumentClient) DeleteOneID(id uuid.UUID) *DocumentDeleteOne {
|
||||||
builder := c.Delete().Where(document.ID(id))
|
builder := c.Delete().Where(document.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -510,7 +510,7 @@ func (c *DocumentClient) GetX(ctx context.Context, id uuid.UUID) *Document {
|
||||||
// QueryGroup queries the group edge of a Document.
|
// QueryGroup queries the group edge of a Document.
|
||||||
func (c *DocumentClient) QueryGroup(d *Document) *GroupQuery {
|
func (c *DocumentClient) QueryGroup(d *Document) *GroupQuery {
|
||||||
query := &GroupQuery{config: c.config}
|
query := &GroupQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := d.ID
|
id := d.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(document.Table, document.FieldID, id),
|
sqlgraph.From(document.Table, document.FieldID, id),
|
||||||
|
@ -526,7 +526,7 @@ func (c *DocumentClient) QueryGroup(d *Document) *GroupQuery {
|
||||||
// QueryDocumentTokens queries the document_tokens edge of a Document.
|
// QueryDocumentTokens queries the document_tokens edge of a Document.
|
||||||
func (c *DocumentClient) QueryDocumentTokens(d *Document) *DocumentTokenQuery {
|
func (c *DocumentClient) QueryDocumentTokens(d *Document) *DocumentTokenQuery {
|
||||||
query := &DocumentTokenQuery{config: c.config}
|
query := &DocumentTokenQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := d.ID
|
id := d.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(document.Table, document.FieldID, id),
|
sqlgraph.From(document.Table, document.FieldID, id),
|
||||||
|
@ -542,7 +542,7 @@ func (c *DocumentClient) QueryDocumentTokens(d *Document) *DocumentTokenQuery {
|
||||||
// QueryAttachments queries the attachments edge of a Document.
|
// QueryAttachments queries the attachments edge of a Document.
|
||||||
func (c *DocumentClient) QueryAttachments(d *Document) *AttachmentQuery {
|
func (c *DocumentClient) QueryAttachments(d *Document) *AttachmentQuery {
|
||||||
query := &AttachmentQuery{config: c.config}
|
query := &AttachmentQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := d.ID
|
id := d.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(document.Table, document.FieldID, id),
|
sqlgraph.From(document.Table, document.FieldID, id),
|
||||||
|
@ -616,7 +616,7 @@ func (c *DocumentTokenClient) DeleteOne(dt *DocumentToken) *DocumentTokenDeleteO
|
||||||
return c.DeleteOneID(dt.ID)
|
return c.DeleteOneID(dt.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *DocumentTokenClient) DeleteOneID(id uuid.UUID) *DocumentTokenDeleteOne {
|
func (c *DocumentTokenClient) DeleteOneID(id uuid.UUID) *DocumentTokenDeleteOne {
|
||||||
builder := c.Delete().Where(documenttoken.ID(id))
|
builder := c.Delete().Where(documenttoken.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -648,7 +648,7 @@ func (c *DocumentTokenClient) GetX(ctx context.Context, id uuid.UUID) *DocumentT
|
||||||
// QueryDocument queries the document edge of a DocumentToken.
|
// QueryDocument queries the document edge of a DocumentToken.
|
||||||
func (c *DocumentTokenClient) QueryDocument(dt *DocumentToken) *DocumentQuery {
|
func (c *DocumentTokenClient) QueryDocument(dt *DocumentToken) *DocumentQuery {
|
||||||
query := &DocumentQuery{config: c.config}
|
query := &DocumentQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := dt.ID
|
id := dt.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(documenttoken.Table, documenttoken.FieldID, id),
|
sqlgraph.From(documenttoken.Table, documenttoken.FieldID, id),
|
||||||
|
@ -722,7 +722,7 @@ func (c *GroupClient) DeleteOne(gr *Group) *GroupDeleteOne {
|
||||||
return c.DeleteOneID(gr.ID)
|
return c.DeleteOneID(gr.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *GroupClient) DeleteOneID(id uuid.UUID) *GroupDeleteOne {
|
func (c *GroupClient) DeleteOneID(id uuid.UUID) *GroupDeleteOne {
|
||||||
builder := c.Delete().Where(group.ID(id))
|
builder := c.Delete().Where(group.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -754,7 +754,7 @@ func (c *GroupClient) GetX(ctx context.Context, id uuid.UUID) *Group {
|
||||||
// QueryUsers queries the users edge of a Group.
|
// QueryUsers queries the users edge of a Group.
|
||||||
func (c *GroupClient) QueryUsers(gr *Group) *UserQuery {
|
func (c *GroupClient) QueryUsers(gr *Group) *UserQuery {
|
||||||
query := &UserQuery{config: c.config}
|
query := &UserQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := gr.ID
|
id := gr.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(group.Table, group.FieldID, id),
|
sqlgraph.From(group.Table, group.FieldID, id),
|
||||||
|
@ -770,7 +770,7 @@ func (c *GroupClient) QueryUsers(gr *Group) *UserQuery {
|
||||||
// QueryLocations queries the locations edge of a Group.
|
// QueryLocations queries the locations edge of a Group.
|
||||||
func (c *GroupClient) QueryLocations(gr *Group) *LocationQuery {
|
func (c *GroupClient) QueryLocations(gr *Group) *LocationQuery {
|
||||||
query := &LocationQuery{config: c.config}
|
query := &LocationQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := gr.ID
|
id := gr.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(group.Table, group.FieldID, id),
|
sqlgraph.From(group.Table, group.FieldID, id),
|
||||||
|
@ -786,7 +786,7 @@ func (c *GroupClient) QueryLocations(gr *Group) *LocationQuery {
|
||||||
// QueryItems queries the items edge of a Group.
|
// QueryItems queries the items edge of a Group.
|
||||||
func (c *GroupClient) QueryItems(gr *Group) *ItemQuery {
|
func (c *GroupClient) QueryItems(gr *Group) *ItemQuery {
|
||||||
query := &ItemQuery{config: c.config}
|
query := &ItemQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := gr.ID
|
id := gr.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(group.Table, group.FieldID, id),
|
sqlgraph.From(group.Table, group.FieldID, id),
|
||||||
|
@ -802,7 +802,7 @@ func (c *GroupClient) QueryItems(gr *Group) *ItemQuery {
|
||||||
// QueryLabels queries the labels edge of a Group.
|
// QueryLabels queries the labels edge of a Group.
|
||||||
func (c *GroupClient) QueryLabels(gr *Group) *LabelQuery {
|
func (c *GroupClient) QueryLabels(gr *Group) *LabelQuery {
|
||||||
query := &LabelQuery{config: c.config}
|
query := &LabelQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := gr.ID
|
id := gr.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(group.Table, group.FieldID, id),
|
sqlgraph.From(group.Table, group.FieldID, id),
|
||||||
|
@ -818,7 +818,7 @@ func (c *GroupClient) QueryLabels(gr *Group) *LabelQuery {
|
||||||
// QueryDocuments queries the documents edge of a Group.
|
// QueryDocuments queries the documents edge of a Group.
|
||||||
func (c *GroupClient) QueryDocuments(gr *Group) *DocumentQuery {
|
func (c *GroupClient) QueryDocuments(gr *Group) *DocumentQuery {
|
||||||
query := &DocumentQuery{config: c.config}
|
query := &DocumentQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := gr.ID
|
id := gr.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(group.Table, group.FieldID, id),
|
sqlgraph.From(group.Table, group.FieldID, id),
|
||||||
|
@ -834,7 +834,7 @@ func (c *GroupClient) QueryDocuments(gr *Group) *DocumentQuery {
|
||||||
// QueryInvitationTokens queries the invitation_tokens edge of a Group.
|
// QueryInvitationTokens queries the invitation_tokens edge of a Group.
|
||||||
func (c *GroupClient) QueryInvitationTokens(gr *Group) *GroupInvitationTokenQuery {
|
func (c *GroupClient) QueryInvitationTokens(gr *Group) *GroupInvitationTokenQuery {
|
||||||
query := &GroupInvitationTokenQuery{config: c.config}
|
query := &GroupInvitationTokenQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := gr.ID
|
id := gr.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(group.Table, group.FieldID, id),
|
sqlgraph.From(group.Table, group.FieldID, id),
|
||||||
|
@ -908,7 +908,7 @@ func (c *GroupInvitationTokenClient) DeleteOne(git *GroupInvitationToken) *Group
|
||||||
return c.DeleteOneID(git.ID)
|
return c.DeleteOneID(git.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *GroupInvitationTokenClient) DeleteOneID(id uuid.UUID) *GroupInvitationTokenDeleteOne {
|
func (c *GroupInvitationTokenClient) DeleteOneID(id uuid.UUID) *GroupInvitationTokenDeleteOne {
|
||||||
builder := c.Delete().Where(groupinvitationtoken.ID(id))
|
builder := c.Delete().Where(groupinvitationtoken.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -940,7 +940,7 @@ func (c *GroupInvitationTokenClient) GetX(ctx context.Context, id uuid.UUID) *Gr
|
||||||
// QueryGroup queries the group edge of a GroupInvitationToken.
|
// QueryGroup queries the group edge of a GroupInvitationToken.
|
||||||
func (c *GroupInvitationTokenClient) QueryGroup(git *GroupInvitationToken) *GroupQuery {
|
func (c *GroupInvitationTokenClient) QueryGroup(git *GroupInvitationToken) *GroupQuery {
|
||||||
query := &GroupQuery{config: c.config}
|
query := &GroupQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := git.ID
|
id := git.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(groupinvitationtoken.Table, groupinvitationtoken.FieldID, id),
|
sqlgraph.From(groupinvitationtoken.Table, groupinvitationtoken.FieldID, id),
|
||||||
|
@ -1014,7 +1014,7 @@ func (c *ItemClient) DeleteOne(i *Item) *ItemDeleteOne {
|
||||||
return c.DeleteOneID(i.ID)
|
return c.DeleteOneID(i.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *ItemClient) DeleteOneID(id uuid.UUID) *ItemDeleteOne {
|
func (c *ItemClient) DeleteOneID(id uuid.UUID) *ItemDeleteOne {
|
||||||
builder := c.Delete().Where(item.ID(id))
|
builder := c.Delete().Where(item.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -1046,7 +1046,7 @@ func (c *ItemClient) GetX(ctx context.Context, id uuid.UUID) *Item {
|
||||||
// QueryParent queries the parent edge of a Item.
|
// QueryParent queries the parent edge of a Item.
|
||||||
func (c *ItemClient) QueryParent(i *Item) *ItemQuery {
|
func (c *ItemClient) QueryParent(i *Item) *ItemQuery {
|
||||||
query := &ItemQuery{config: c.config}
|
query := &ItemQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := i.ID
|
id := i.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(item.Table, item.FieldID, id),
|
sqlgraph.From(item.Table, item.FieldID, id),
|
||||||
|
@ -1062,7 +1062,7 @@ func (c *ItemClient) QueryParent(i *Item) *ItemQuery {
|
||||||
// QueryChildren queries the children edge of a Item.
|
// QueryChildren queries the children edge of a Item.
|
||||||
func (c *ItemClient) QueryChildren(i *Item) *ItemQuery {
|
func (c *ItemClient) QueryChildren(i *Item) *ItemQuery {
|
||||||
query := &ItemQuery{config: c.config}
|
query := &ItemQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := i.ID
|
id := i.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(item.Table, item.FieldID, id),
|
sqlgraph.From(item.Table, item.FieldID, id),
|
||||||
|
@ -1078,7 +1078,7 @@ func (c *ItemClient) QueryChildren(i *Item) *ItemQuery {
|
||||||
// QueryGroup queries the group edge of a Item.
|
// QueryGroup queries the group edge of a Item.
|
||||||
func (c *ItemClient) QueryGroup(i *Item) *GroupQuery {
|
func (c *ItemClient) QueryGroup(i *Item) *GroupQuery {
|
||||||
query := &GroupQuery{config: c.config}
|
query := &GroupQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := i.ID
|
id := i.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(item.Table, item.FieldID, id),
|
sqlgraph.From(item.Table, item.FieldID, id),
|
||||||
|
@ -1094,7 +1094,7 @@ func (c *ItemClient) QueryGroup(i *Item) *GroupQuery {
|
||||||
// QueryLabel queries the label edge of a Item.
|
// QueryLabel queries the label edge of a Item.
|
||||||
func (c *ItemClient) QueryLabel(i *Item) *LabelQuery {
|
func (c *ItemClient) QueryLabel(i *Item) *LabelQuery {
|
||||||
query := &LabelQuery{config: c.config}
|
query := &LabelQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := i.ID
|
id := i.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(item.Table, item.FieldID, id),
|
sqlgraph.From(item.Table, item.FieldID, id),
|
||||||
|
@ -1110,7 +1110,7 @@ func (c *ItemClient) QueryLabel(i *Item) *LabelQuery {
|
||||||
// QueryLocation queries the location edge of a Item.
|
// QueryLocation queries the location edge of a Item.
|
||||||
func (c *ItemClient) QueryLocation(i *Item) *LocationQuery {
|
func (c *ItemClient) QueryLocation(i *Item) *LocationQuery {
|
||||||
query := &LocationQuery{config: c.config}
|
query := &LocationQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := i.ID
|
id := i.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(item.Table, item.FieldID, id),
|
sqlgraph.From(item.Table, item.FieldID, id),
|
||||||
|
@ -1126,7 +1126,7 @@ func (c *ItemClient) QueryLocation(i *Item) *LocationQuery {
|
||||||
// QueryFields queries the fields edge of a Item.
|
// QueryFields queries the fields edge of a Item.
|
||||||
func (c *ItemClient) QueryFields(i *Item) *ItemFieldQuery {
|
func (c *ItemClient) QueryFields(i *Item) *ItemFieldQuery {
|
||||||
query := &ItemFieldQuery{config: c.config}
|
query := &ItemFieldQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := i.ID
|
id := i.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(item.Table, item.FieldID, id),
|
sqlgraph.From(item.Table, item.FieldID, id),
|
||||||
|
@ -1142,7 +1142,7 @@ func (c *ItemClient) QueryFields(i *Item) *ItemFieldQuery {
|
||||||
// QueryAttachments queries the attachments edge of a Item.
|
// QueryAttachments queries the attachments edge of a Item.
|
||||||
func (c *ItemClient) QueryAttachments(i *Item) *AttachmentQuery {
|
func (c *ItemClient) QueryAttachments(i *Item) *AttachmentQuery {
|
||||||
query := &AttachmentQuery{config: c.config}
|
query := &AttachmentQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := i.ID
|
id := i.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(item.Table, item.FieldID, id),
|
sqlgraph.From(item.Table, item.FieldID, id),
|
||||||
|
@ -1216,7 +1216,7 @@ func (c *ItemFieldClient) DeleteOne(_if *ItemField) *ItemFieldDeleteOne {
|
||||||
return c.DeleteOneID(_if.ID)
|
return c.DeleteOneID(_if.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *ItemFieldClient) DeleteOneID(id uuid.UUID) *ItemFieldDeleteOne {
|
func (c *ItemFieldClient) DeleteOneID(id uuid.UUID) *ItemFieldDeleteOne {
|
||||||
builder := c.Delete().Where(itemfield.ID(id))
|
builder := c.Delete().Where(itemfield.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -1248,7 +1248,7 @@ func (c *ItemFieldClient) GetX(ctx context.Context, id uuid.UUID) *ItemField {
|
||||||
// QueryItem queries the item edge of a ItemField.
|
// QueryItem queries the item edge of a ItemField.
|
||||||
func (c *ItemFieldClient) QueryItem(_if *ItemField) *ItemQuery {
|
func (c *ItemFieldClient) QueryItem(_if *ItemField) *ItemQuery {
|
||||||
query := &ItemQuery{config: c.config}
|
query := &ItemQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := _if.ID
|
id := _if.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(itemfield.Table, itemfield.FieldID, id),
|
sqlgraph.From(itemfield.Table, itemfield.FieldID, id),
|
||||||
|
@ -1322,7 +1322,7 @@ func (c *LabelClient) DeleteOne(l *Label) *LabelDeleteOne {
|
||||||
return c.DeleteOneID(l.ID)
|
return c.DeleteOneID(l.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *LabelClient) DeleteOneID(id uuid.UUID) *LabelDeleteOne {
|
func (c *LabelClient) DeleteOneID(id uuid.UUID) *LabelDeleteOne {
|
||||||
builder := c.Delete().Where(label.ID(id))
|
builder := c.Delete().Where(label.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -1354,7 +1354,7 @@ func (c *LabelClient) GetX(ctx context.Context, id uuid.UUID) *Label {
|
||||||
// QueryGroup queries the group edge of a Label.
|
// QueryGroup queries the group edge of a Label.
|
||||||
func (c *LabelClient) QueryGroup(l *Label) *GroupQuery {
|
func (c *LabelClient) QueryGroup(l *Label) *GroupQuery {
|
||||||
query := &GroupQuery{config: c.config}
|
query := &GroupQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := l.ID
|
id := l.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(label.Table, label.FieldID, id),
|
sqlgraph.From(label.Table, label.FieldID, id),
|
||||||
|
@ -1370,7 +1370,7 @@ func (c *LabelClient) QueryGroup(l *Label) *GroupQuery {
|
||||||
// QueryItems queries the items edge of a Label.
|
// QueryItems queries the items edge of a Label.
|
||||||
func (c *LabelClient) QueryItems(l *Label) *ItemQuery {
|
func (c *LabelClient) QueryItems(l *Label) *ItemQuery {
|
||||||
query := &ItemQuery{config: c.config}
|
query := &ItemQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := l.ID
|
id := l.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(label.Table, label.FieldID, id),
|
sqlgraph.From(label.Table, label.FieldID, id),
|
||||||
|
@ -1444,7 +1444,7 @@ func (c *LocationClient) DeleteOne(l *Location) *LocationDeleteOne {
|
||||||
return c.DeleteOneID(l.ID)
|
return c.DeleteOneID(l.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *LocationClient) DeleteOneID(id uuid.UUID) *LocationDeleteOne {
|
func (c *LocationClient) DeleteOneID(id uuid.UUID) *LocationDeleteOne {
|
||||||
builder := c.Delete().Where(location.ID(id))
|
builder := c.Delete().Where(location.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -1476,7 +1476,7 @@ func (c *LocationClient) GetX(ctx context.Context, id uuid.UUID) *Location {
|
||||||
// QueryParent queries the parent edge of a Location.
|
// QueryParent queries the parent edge of a Location.
|
||||||
func (c *LocationClient) QueryParent(l *Location) *LocationQuery {
|
func (c *LocationClient) QueryParent(l *Location) *LocationQuery {
|
||||||
query := &LocationQuery{config: c.config}
|
query := &LocationQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := l.ID
|
id := l.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(location.Table, location.FieldID, id),
|
sqlgraph.From(location.Table, location.FieldID, id),
|
||||||
|
@ -1492,7 +1492,7 @@ func (c *LocationClient) QueryParent(l *Location) *LocationQuery {
|
||||||
// QueryChildren queries the children edge of a Location.
|
// QueryChildren queries the children edge of a Location.
|
||||||
func (c *LocationClient) QueryChildren(l *Location) *LocationQuery {
|
func (c *LocationClient) QueryChildren(l *Location) *LocationQuery {
|
||||||
query := &LocationQuery{config: c.config}
|
query := &LocationQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := l.ID
|
id := l.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(location.Table, location.FieldID, id),
|
sqlgraph.From(location.Table, location.FieldID, id),
|
||||||
|
@ -1508,7 +1508,7 @@ func (c *LocationClient) QueryChildren(l *Location) *LocationQuery {
|
||||||
// QueryGroup queries the group edge of a Location.
|
// QueryGroup queries the group edge of a Location.
|
||||||
func (c *LocationClient) QueryGroup(l *Location) *GroupQuery {
|
func (c *LocationClient) QueryGroup(l *Location) *GroupQuery {
|
||||||
query := &GroupQuery{config: c.config}
|
query := &GroupQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := l.ID
|
id := l.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(location.Table, location.FieldID, id),
|
sqlgraph.From(location.Table, location.FieldID, id),
|
||||||
|
@ -1524,7 +1524,7 @@ func (c *LocationClient) QueryGroup(l *Location) *GroupQuery {
|
||||||
// QueryItems queries the items edge of a Location.
|
// QueryItems queries the items edge of a Location.
|
||||||
func (c *LocationClient) QueryItems(l *Location) *ItemQuery {
|
func (c *LocationClient) QueryItems(l *Location) *ItemQuery {
|
||||||
query := &ItemQuery{config: c.config}
|
query := &ItemQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := l.ID
|
id := l.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(location.Table, location.FieldID, id),
|
sqlgraph.From(location.Table, location.FieldID, id),
|
||||||
|
@ -1598,7 +1598,7 @@ func (c *UserClient) DeleteOne(u *User) *UserDeleteOne {
|
||||||
return c.DeleteOneID(u.ID)
|
return c.DeleteOneID(u.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne returns a builder for deleting the given entity by its id.
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
func (c *UserClient) DeleteOneID(id uuid.UUID) *UserDeleteOne {
|
func (c *UserClient) DeleteOneID(id uuid.UUID) *UserDeleteOne {
|
||||||
builder := c.Delete().Where(user.ID(id))
|
builder := c.Delete().Where(user.ID(id))
|
||||||
builder.mutation.id = &id
|
builder.mutation.id = &id
|
||||||
|
@ -1630,7 +1630,7 @@ func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {
|
||||||
// QueryGroup queries the group edge of a User.
|
// QueryGroup queries the group edge of a User.
|
||||||
func (c *UserClient) QueryGroup(u *User) *GroupQuery {
|
func (c *UserClient) QueryGroup(u *User) *GroupQuery {
|
||||||
query := &GroupQuery{config: c.config}
|
query := &GroupQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := u.ID
|
id := u.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(user.Table, user.FieldID, id),
|
sqlgraph.From(user.Table, user.FieldID, id),
|
||||||
|
@ -1646,7 +1646,7 @@ func (c *UserClient) QueryGroup(u *User) *GroupQuery {
|
||||||
// QueryAuthTokens queries the auth_tokens edge of a User.
|
// QueryAuthTokens queries the auth_tokens edge of a User.
|
||||||
func (c *UserClient) QueryAuthTokens(u *User) *AuthTokensQuery {
|
func (c *UserClient) QueryAuthTokens(u *User) *AuthTokensQuery {
|
||||||
query := &AuthTokensQuery{config: c.config}
|
query := &AuthTokensQuery{config: c.config}
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||||
id := u.ID
|
id := u.ID
|
||||||
step := sqlgraph.NewStep(
|
step := sqlgraph.NewStep(
|
||||||
sqlgraph.From(user.Table, user.FieldID, id),
|
sqlgraph.From(user.Table, user.FieldID, id),
|
||||||
|
|
|
@ -274,35 +274,19 @@ func (dc *DocumentCreate) createSpec() (*Document, *sqlgraph.CreateSpec) {
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := dc.mutation.CreatedAt(); ok {
|
if value, ok := dc.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := dc.mutation.UpdatedAt(); ok {
|
if value, ok := dc.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := dc.mutation.Title(); ok {
|
if value, ok := dc.mutation.Title(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldTitle, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldTitle,
|
|
||||||
})
|
|
||||||
_node.Title = value
|
_node.Title = value
|
||||||
}
|
}
|
||||||
if value, ok := dc.mutation.Path(); ok {
|
if value, ok := dc.mutation.Path(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldPath, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldPath,
|
|
||||||
})
|
|
||||||
_node.Path = value
|
_node.Path = value
|
||||||
}
|
}
|
||||||
if nodes := dc.mutation.GroupIDs(); len(nodes) > 0 {
|
if nodes := dc.mutation.GroupIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -406,6 +406,11 @@ func (dq *DocumentQuery) Select(fields ...string) *DocumentSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a DocumentSelect configured with the given aggregations.
|
||||||
|
func (dq *DocumentQuery) Aggregate(fns ...AggregateFunc) *DocumentSelect {
|
||||||
|
return dq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (dq *DocumentQuery) prepareQuery(ctx context.Context) error {
|
func (dq *DocumentQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range dq.fields {
|
for _, f := range dq.fields {
|
||||||
if !document.ValidColumn(f) {
|
if !document.ValidColumn(f) {
|
||||||
|
@ -724,8 +729,6 @@ func (dgb *DocumentGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range dgb.fns {
|
for _, fn := range dgb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(dgb.fields)+len(dgb.fns))
|
columns := make([]string, 0, len(dgb.fields)+len(dgb.fns))
|
||||||
for _, f := range dgb.fields {
|
for _, f := range dgb.fields {
|
||||||
|
@ -745,6 +748,12 @@ type DocumentSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (ds *DocumentSelect) Aggregate(fns ...AggregateFunc) *DocumentSelect {
|
||||||
|
ds.fns = append(ds.fns, fns...)
|
||||||
|
return ds
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (ds *DocumentSelect) Scan(ctx context.Context, v any) error {
|
func (ds *DocumentSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := ds.prepareQuery(ctx); err != nil {
|
if err := ds.prepareQuery(ctx); err != nil {
|
||||||
|
@ -755,6 +764,16 @@ func (ds *DocumentSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ds *DocumentSelect) sqlScan(ctx context.Context, v any) error {
|
func (ds *DocumentSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(ds.fns))
|
||||||
|
for _, fn := range ds.fns {
|
||||||
|
aggregation = append(aggregation, fn(ds.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*ds.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
ds.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
ds.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := ds.sql.Query()
|
query, args := ds.sql.Query()
|
||||||
if err := ds.driver.Query(ctx, query, args, rows); err != nil {
|
if err := ds.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -250,25 +250,13 @@ func (du *DocumentUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := du.mutation.UpdatedAt(); ok {
|
if value, ok := du.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := du.mutation.Title(); ok {
|
if value, ok := du.mutation.Title(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldTitle, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldTitle,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := du.mutation.Path(); ok {
|
if value, ok := du.mutation.Path(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldPath, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldPath,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if du.mutation.GroupCleared() {
|
if du.mutation.GroupCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -680,25 +668,13 @@ func (duo *DocumentUpdateOne) sqlSave(ctx context.Context) (_node *Document, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := duo.mutation.UpdatedAt(); ok {
|
if value, ok := duo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := duo.mutation.Title(); ok {
|
if value, ok := duo.mutation.Title(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldTitle, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldTitle,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := duo.mutation.Path(); ok {
|
if value, ok := duo.mutation.Path(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(document.FieldPath, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: document.FieldPath,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if duo.mutation.GroupCleared() {
|
if duo.mutation.GroupCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -275,43 +275,23 @@ func (dtc *DocumentTokenCreate) createSpec() (*DocumentToken, *sqlgraph.CreateSp
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := dtc.mutation.CreatedAt(); ok {
|
if value, ok := dtc.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := dtc.mutation.UpdatedAt(); ok {
|
if value, ok := dtc.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := dtc.mutation.Token(); ok {
|
if value, ok := dtc.mutation.Token(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldToken, field.TypeBytes, value)
|
||||||
Type: field.TypeBytes,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldToken,
|
|
||||||
})
|
|
||||||
_node.Token = value
|
_node.Token = value
|
||||||
}
|
}
|
||||||
if value, ok := dtc.mutation.Uses(); ok {
|
if value, ok := dtc.mutation.Uses(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldUses,
|
|
||||||
})
|
|
||||||
_node.Uses = value
|
_node.Uses = value
|
||||||
}
|
}
|
||||||
if value, ok := dtc.mutation.ExpiresAt(); ok {
|
if value, ok := dtc.mutation.ExpiresAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldExpiresAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldExpiresAt,
|
|
||||||
})
|
|
||||||
_node.ExpiresAt = value
|
_node.ExpiresAt = value
|
||||||
}
|
}
|
||||||
if nodes := dtc.mutation.DocumentIDs(); len(nodes) > 0 {
|
if nodes := dtc.mutation.DocumentIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -333,6 +333,11 @@ func (dtq *DocumentTokenQuery) Select(fields ...string) *DocumentTokenSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a DocumentTokenSelect configured with the given aggregations.
|
||||||
|
func (dtq *DocumentTokenQuery) Aggregate(fns ...AggregateFunc) *DocumentTokenSelect {
|
||||||
|
return dtq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (dtq *DocumentTokenQuery) prepareQuery(ctx context.Context) error {
|
func (dtq *DocumentTokenQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range dtq.fields {
|
for _, f := range dtq.fields {
|
||||||
if !documenttoken.ValidColumn(f) {
|
if !documenttoken.ValidColumn(f) {
|
||||||
|
@ -573,8 +578,6 @@ func (dtgb *DocumentTokenGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range dtgb.fns {
|
for _, fn := range dtgb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(dtgb.fields)+len(dtgb.fns))
|
columns := make([]string, 0, len(dtgb.fields)+len(dtgb.fns))
|
||||||
for _, f := range dtgb.fields {
|
for _, f := range dtgb.fields {
|
||||||
|
@ -594,6 +597,12 @@ type DocumentTokenSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (dts *DocumentTokenSelect) Aggregate(fns ...AggregateFunc) *DocumentTokenSelect {
|
||||||
|
dts.fns = append(dts.fns, fns...)
|
||||||
|
return dts
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (dts *DocumentTokenSelect) Scan(ctx context.Context, v any) error {
|
func (dts *DocumentTokenSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := dts.prepareQuery(ctx); err != nil {
|
if err := dts.prepareQuery(ctx); err != nil {
|
||||||
|
@ -604,6 +613,16 @@ func (dts *DocumentTokenSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dts *DocumentTokenSelect) sqlScan(ctx context.Context, v any) error {
|
func (dts *DocumentTokenSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(dts.fns))
|
||||||
|
for _, fn := range dts.fns {
|
||||||
|
aggregation = append(aggregation, fn(dts.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*dts.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
dts.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
dts.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := dts.sql.Query()
|
query, args := dts.sql.Query()
|
||||||
if err := dts.driver.Query(ctx, query, args, rows); err != nil {
|
if err := dts.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -205,39 +205,19 @@ func (dtu *DocumentTokenUpdate) sqlSave(ctx context.Context) (n int, err error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := dtu.mutation.UpdatedAt(); ok {
|
if value, ok := dtu.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := dtu.mutation.Token(); ok {
|
if value, ok := dtu.mutation.Token(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldToken, field.TypeBytes, value)
|
||||||
Type: field.TypeBytes,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldToken,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := dtu.mutation.Uses(); ok {
|
if value, ok := dtu.mutation.Uses(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldUses,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := dtu.mutation.AddedUses(); ok {
|
if value, ok := dtu.mutation.AddedUses(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(documenttoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldUses,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := dtu.mutation.ExpiresAt(); ok {
|
if value, ok := dtu.mutation.ExpiresAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldExpiresAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldExpiresAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if dtu.mutation.DocumentCleared() {
|
if dtu.mutation.DocumentCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -498,39 +478,19 @@ func (dtuo *DocumentTokenUpdateOne) sqlSave(ctx context.Context) (_node *Documen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := dtuo.mutation.UpdatedAt(); ok {
|
if value, ok := dtuo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := dtuo.mutation.Token(); ok {
|
if value, ok := dtuo.mutation.Token(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldToken, field.TypeBytes, value)
|
||||||
Type: field.TypeBytes,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldToken,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := dtuo.mutation.Uses(); ok {
|
if value, ok := dtuo.mutation.Uses(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldUses,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := dtuo.mutation.AddedUses(); ok {
|
if value, ok := dtuo.mutation.AddedUses(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(documenttoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldUses,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := dtuo.mutation.ExpiresAt(); ok {
|
if value, ok := dtuo.mutation.ExpiresAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(documenttoken.FieldExpiresAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: documenttoken.FieldExpiresAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if dtuo.mutation.DocumentCleared() {
|
if dtuo.mutation.DocumentCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -283,6 +283,7 @@ func IsConstraintError(err error) bool {
|
||||||
type selector struct {
|
type selector struct {
|
||||||
label string
|
label string
|
||||||
flds *[]string
|
flds *[]string
|
||||||
|
fns []AggregateFunc
|
||||||
scan func(context.Context, any) error
|
scan func(context.Context, any) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,7 @@ const (
|
||||||
CurrencySek Currency = "sek"
|
CurrencySek Currency = "sek"
|
||||||
CurrencyDkk Currency = "dkk"
|
CurrencyDkk Currency = "dkk"
|
||||||
CurrencyInr Currency = "inr"
|
CurrencyInr Currency = "inr"
|
||||||
|
CurrencyRmb Currency = "rmb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c Currency) String() string {
|
func (c Currency) String() string {
|
||||||
|
@ -139,7 +140,7 @@ func (c Currency) String() string {
|
||||||
// CurrencyValidator is a validator for the "currency" field enum values. It is called by the builders before save.
|
// CurrencyValidator is a validator for the "currency" field enum values. It is called by the builders before save.
|
||||||
func CurrencyValidator(c Currency) error {
|
func CurrencyValidator(c Currency) error {
|
||||||
switch c {
|
switch c {
|
||||||
case CurrencyUsd, CurrencyEur, CurrencyGbp, CurrencyJpy, CurrencyZar, CurrencyAud, CurrencyNok, CurrencySek, CurrencyDkk, CurrencyInr:
|
case CurrencyUsd, CurrencyEur, CurrencyGbp, CurrencyJpy, CurrencyZar, CurrencyAud, CurrencyNok, CurrencySek, CurrencyDkk, CurrencyInr, CurrencyRmb:
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("group: invalid enum value for currency field: %q", c)
|
return fmt.Errorf("group: invalid enum value for currency field: %q", c)
|
||||||
|
|
|
@ -335,35 +335,19 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := gc.mutation.CreatedAt(); ok {
|
if value, ok := gc.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := gc.mutation.UpdatedAt(); ok {
|
if value, ok := gc.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := gc.mutation.Name(); ok {
|
if value, ok := gc.mutation.Name(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldName,
|
|
||||||
})
|
|
||||||
_node.Name = value
|
_node.Name = value
|
||||||
}
|
}
|
||||||
if value, ok := gc.mutation.Currency(); ok {
|
if value, ok := gc.mutation.Currency(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldCurrency, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldCurrency,
|
|
||||||
})
|
|
||||||
_node.Currency = value
|
_node.Currency = value
|
||||||
}
|
}
|
||||||
if nodes := gc.mutation.UsersIDs(); len(nodes) > 0 {
|
if nodes := gc.mutation.UsersIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -513,6 +513,11 @@ func (gq *GroupQuery) Select(fields ...string) *GroupSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a GroupSelect configured with the given aggregations.
|
||||||
|
func (gq *GroupQuery) Aggregate(fns ...AggregateFunc) *GroupSelect {
|
||||||
|
return gq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (gq *GroupQuery) prepareQuery(ctx context.Context) error {
|
func (gq *GroupQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range gq.fields {
|
for _, f := range gq.fields {
|
||||||
if !group.ValidColumn(f) {
|
if !group.ValidColumn(f) {
|
||||||
|
@ -946,8 +951,6 @@ func (ggb *GroupGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range ggb.fns {
|
for _, fn := range ggb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(ggb.fields)+len(ggb.fns))
|
columns := make([]string, 0, len(ggb.fields)+len(ggb.fns))
|
||||||
for _, f := range ggb.fields {
|
for _, f := range ggb.fields {
|
||||||
|
@ -967,6 +970,12 @@ type GroupSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect {
|
||||||
|
gs.fns = append(gs.fns, fns...)
|
||||||
|
return gs
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (gs *GroupSelect) Scan(ctx context.Context, v any) error {
|
func (gs *GroupSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := gs.prepareQuery(ctx); err != nil {
|
if err := gs.prepareQuery(ctx); err != nil {
|
||||||
|
@ -977,6 +986,16 @@ func (gs *GroupSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gs *GroupSelect) sqlScan(ctx context.Context, v any) error {
|
func (gs *GroupSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(gs.fns))
|
||||||
|
for _, fn := range gs.fns {
|
||||||
|
aggregation = append(aggregation, fn(gs.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*gs.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
gs.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
gs.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := gs.sql.Query()
|
query, args := gs.sql.Query()
|
||||||
if err := gs.driver.Query(ctx, query, args, rows); err != nil {
|
if err := gs.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -385,25 +385,13 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := gu.mutation.UpdatedAt(); ok {
|
if value, ok := gu.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gu.mutation.Name(); ok {
|
if value, ok := gu.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gu.mutation.Currency(); ok {
|
if value, ok := gu.mutation.Currency(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldCurrency, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldCurrency,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if gu.mutation.UsersCleared() {
|
if gu.mutation.UsersCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -1128,25 +1116,13 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := guo.mutation.UpdatedAt(); ok {
|
if value, ok := guo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := guo.mutation.Name(); ok {
|
if value, ok := guo.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := guo.mutation.Currency(); ok {
|
if value, ok := guo.mutation.Currency(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(group.FieldCurrency, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: group.FieldCurrency,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if guo.mutation.UsersCleared() {
|
if guo.mutation.UsersCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -270,43 +270,23 @@ func (gitc *GroupInvitationTokenCreate) createSpec() (*GroupInvitationToken, *sq
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := gitc.mutation.CreatedAt(); ok {
|
if value, ok := gitc.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := gitc.mutation.UpdatedAt(); ok {
|
if value, ok := gitc.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := gitc.mutation.Token(); ok {
|
if value, ok := gitc.mutation.Token(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldToken, field.TypeBytes, value)
|
||||||
Type: field.TypeBytes,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldToken,
|
|
||||||
})
|
|
||||||
_node.Token = value
|
_node.Token = value
|
||||||
}
|
}
|
||||||
if value, ok := gitc.mutation.ExpiresAt(); ok {
|
if value, ok := gitc.mutation.ExpiresAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldExpiresAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldExpiresAt,
|
|
||||||
})
|
|
||||||
_node.ExpiresAt = value
|
_node.ExpiresAt = value
|
||||||
}
|
}
|
||||||
if value, ok := gitc.mutation.Uses(); ok {
|
if value, ok := gitc.mutation.Uses(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldUses,
|
|
||||||
})
|
|
||||||
_node.Uses = value
|
_node.Uses = value
|
||||||
}
|
}
|
||||||
if nodes := gitc.mutation.GroupIDs(); len(nodes) > 0 {
|
if nodes := gitc.mutation.GroupIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -333,6 +333,11 @@ func (gitq *GroupInvitationTokenQuery) Select(fields ...string) *GroupInvitation
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a GroupInvitationTokenSelect configured with the given aggregations.
|
||||||
|
func (gitq *GroupInvitationTokenQuery) Aggregate(fns ...AggregateFunc) *GroupInvitationTokenSelect {
|
||||||
|
return gitq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (gitq *GroupInvitationTokenQuery) prepareQuery(ctx context.Context) error {
|
func (gitq *GroupInvitationTokenQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range gitq.fields {
|
for _, f := range gitq.fields {
|
||||||
if !groupinvitationtoken.ValidColumn(f) {
|
if !groupinvitationtoken.ValidColumn(f) {
|
||||||
|
@ -573,8 +578,6 @@ func (gitgb *GroupInvitationTokenGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range gitgb.fns {
|
for _, fn := range gitgb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(gitgb.fields)+len(gitgb.fns))
|
columns := make([]string, 0, len(gitgb.fields)+len(gitgb.fns))
|
||||||
for _, f := range gitgb.fields {
|
for _, f := range gitgb.fields {
|
||||||
|
@ -594,6 +597,12 @@ type GroupInvitationTokenSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (gits *GroupInvitationTokenSelect) Aggregate(fns ...AggregateFunc) *GroupInvitationTokenSelect {
|
||||||
|
gits.fns = append(gits.fns, fns...)
|
||||||
|
return gits
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (gits *GroupInvitationTokenSelect) Scan(ctx context.Context, v any) error {
|
func (gits *GroupInvitationTokenSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := gits.prepareQuery(ctx); err != nil {
|
if err := gits.prepareQuery(ctx); err != nil {
|
||||||
|
@ -604,6 +613,16 @@ func (gits *GroupInvitationTokenSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gits *GroupInvitationTokenSelect) sqlScan(ctx context.Context, v any) error {
|
func (gits *GroupInvitationTokenSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(gits.fns))
|
||||||
|
for _, fn := range gits.fns {
|
||||||
|
aggregation = append(aggregation, fn(gits.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*gits.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
gits.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
gits.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := gits.sql.Query()
|
query, args := gits.sql.Query()
|
||||||
if err := gits.driver.Query(ctx, query, args, rows); err != nil {
|
if err := gits.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -189,39 +189,19 @@ func (gitu *GroupInvitationTokenUpdate) sqlSave(ctx context.Context) (n int, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := gitu.mutation.UpdatedAt(); ok {
|
if value, ok := gitu.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gitu.mutation.Token(); ok {
|
if value, ok := gitu.mutation.Token(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldToken, field.TypeBytes, value)
|
||||||
Type: field.TypeBytes,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldToken,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gitu.mutation.ExpiresAt(); ok {
|
if value, ok := gitu.mutation.ExpiresAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldExpiresAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldExpiresAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gitu.mutation.Uses(); ok {
|
if value, ok := gitu.mutation.Uses(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldUses,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gitu.mutation.AddedUses(); ok {
|
if value, ok := gitu.mutation.AddedUses(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(groupinvitationtoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldUses,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if gitu.mutation.GroupCleared() {
|
if gitu.mutation.GroupCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -466,39 +446,19 @@ func (gituo *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := gituo.mutation.UpdatedAt(); ok {
|
if value, ok := gituo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gituo.mutation.Token(); ok {
|
if value, ok := gituo.mutation.Token(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldToken, field.TypeBytes, value)
|
||||||
Type: field.TypeBytes,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldToken,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gituo.mutation.ExpiresAt(); ok {
|
if value, ok := gituo.mutation.ExpiresAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldExpiresAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldExpiresAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gituo.mutation.Uses(); ok {
|
if value, ok := gituo.mutation.Uses(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(groupinvitationtoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldUses,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := gituo.mutation.AddedUses(); ok {
|
if value, ok := gituo.mutation.AddedUses(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(groupinvitationtoken.FieldUses, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: groupinvitationtoken.FieldUses,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if gituo.mutation.GroupCleared() {
|
if gituo.mutation.GroupCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -699,187 +699,95 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.CreatedAt(); ok {
|
if value, ok := ic.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.UpdatedAt(); ok {
|
if value, ok := ic.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.Name(); ok {
|
if value, ok := ic.mutation.Name(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldName,
|
|
||||||
})
|
|
||||||
_node.Name = value
|
_node.Name = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.Description(); ok {
|
if value, ok := ic.mutation.Description(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldDescription,
|
|
||||||
})
|
|
||||||
_node.Description = value
|
_node.Description = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.ImportRef(); ok {
|
if value, ok := ic.mutation.ImportRef(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldImportRef, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldImportRef,
|
|
||||||
})
|
|
||||||
_node.ImportRef = value
|
_node.ImportRef = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.Notes(); ok {
|
if value, ok := ic.mutation.Notes(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldNotes, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldNotes,
|
|
||||||
})
|
|
||||||
_node.Notes = value
|
_node.Notes = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.Quantity(); ok {
|
if value, ok := ic.mutation.Quantity(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldQuantity, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldQuantity,
|
|
||||||
})
|
|
||||||
_node.Quantity = value
|
_node.Quantity = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.Insured(); ok {
|
if value, ok := ic.mutation.Insured(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldInsured, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldInsured,
|
|
||||||
})
|
|
||||||
_node.Insured = value
|
_node.Insured = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.Archived(); ok {
|
if value, ok := ic.mutation.Archived(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldArchived, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldArchived,
|
|
||||||
})
|
|
||||||
_node.Archived = value
|
_node.Archived = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.AssetID(); ok {
|
if value, ok := ic.mutation.AssetID(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldAssetID, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldAssetID,
|
|
||||||
})
|
|
||||||
_node.AssetID = value
|
_node.AssetID = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.SerialNumber(); ok {
|
if value, ok := ic.mutation.SerialNumber(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSerialNumber, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSerialNumber,
|
|
||||||
})
|
|
||||||
_node.SerialNumber = value
|
_node.SerialNumber = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.ModelNumber(); ok {
|
if value, ok := ic.mutation.ModelNumber(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldModelNumber, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldModelNumber,
|
|
||||||
})
|
|
||||||
_node.ModelNumber = value
|
_node.ModelNumber = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.Manufacturer(); ok {
|
if value, ok := ic.mutation.Manufacturer(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldManufacturer, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldManufacturer,
|
|
||||||
})
|
|
||||||
_node.Manufacturer = value
|
_node.Manufacturer = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.LifetimeWarranty(); ok {
|
if value, ok := ic.mutation.LifetimeWarranty(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldLifetimeWarranty, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldLifetimeWarranty,
|
|
||||||
})
|
|
||||||
_node.LifetimeWarranty = value
|
_node.LifetimeWarranty = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.WarrantyExpires(); ok {
|
if value, ok := ic.mutation.WarrantyExpires(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldWarrantyExpires, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldWarrantyExpires,
|
|
||||||
})
|
|
||||||
_node.WarrantyExpires = value
|
_node.WarrantyExpires = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.WarrantyDetails(); ok {
|
if value, ok := ic.mutation.WarrantyDetails(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldWarrantyDetails, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldWarrantyDetails,
|
|
||||||
})
|
|
||||||
_node.WarrantyDetails = value
|
_node.WarrantyDetails = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.PurchaseTime(); ok {
|
if value, ok := ic.mutation.PurchaseTime(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldPurchaseTime, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchaseTime,
|
|
||||||
})
|
|
||||||
_node.PurchaseTime = value
|
_node.PurchaseTime = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.PurchaseFrom(); ok {
|
if value, ok := ic.mutation.PurchaseFrom(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldPurchaseFrom, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchaseFrom,
|
|
||||||
})
|
|
||||||
_node.PurchaseFrom = value
|
_node.PurchaseFrom = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.PurchasePrice(); ok {
|
if value, ok := ic.mutation.PurchasePrice(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldPurchasePrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchasePrice,
|
|
||||||
})
|
|
||||||
_node.PurchasePrice = value
|
_node.PurchasePrice = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.SoldTime(); ok {
|
if value, ok := ic.mutation.SoldTime(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldTime, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldTime,
|
|
||||||
})
|
|
||||||
_node.SoldTime = value
|
_node.SoldTime = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.SoldTo(); ok {
|
if value, ok := ic.mutation.SoldTo(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldTo, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldTo,
|
|
||||||
})
|
|
||||||
_node.SoldTo = value
|
_node.SoldTo = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.SoldPrice(); ok {
|
if value, ok := ic.mutation.SoldPrice(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldPrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldPrice,
|
|
||||||
})
|
|
||||||
_node.SoldPrice = value
|
_node.SoldPrice = value
|
||||||
}
|
}
|
||||||
if value, ok := ic.mutation.SoldNotes(); ok {
|
if value, ok := ic.mutation.SoldNotes(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldNotes, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldNotes,
|
|
||||||
})
|
|
||||||
_node.SoldNotes = value
|
_node.SoldNotes = value
|
||||||
}
|
}
|
||||||
if nodes := ic.mutation.ParentIDs(); len(nodes) > 0 {
|
if nodes := ic.mutation.ParentIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -548,6 +548,11 @@ func (iq *ItemQuery) Select(fields ...string) *ItemSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a ItemSelect configured with the given aggregations.
|
||||||
|
func (iq *ItemQuery) Aggregate(fns ...AggregateFunc) *ItemSelect {
|
||||||
|
return iq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (iq *ItemQuery) prepareQuery(ctx context.Context) error {
|
func (iq *ItemQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range iq.fields {
|
for _, f := range iq.fields {
|
||||||
if !item.ValidColumn(f) {
|
if !item.ValidColumn(f) {
|
||||||
|
@ -778,7 +783,7 @@ func (iq *ItemQuery) loadLabel(ctx context.Context, query *LabelQuery, nodes []*
|
||||||
outValue := *values[0].(*uuid.UUID)
|
outValue := *values[0].(*uuid.UUID)
|
||||||
inValue := *values[1].(*uuid.UUID)
|
inValue := *values[1].(*uuid.UUID)
|
||||||
if nids[inValue] == nil {
|
if nids[inValue] == nil {
|
||||||
nids[inValue] = map[*Item]struct{}{byID[outValue]: struct{}{}}
|
nids[inValue] = map[*Item]struct{}{byID[outValue]: {}}
|
||||||
return assign(columns[1:], values[1:])
|
return assign(columns[1:], values[1:])
|
||||||
}
|
}
|
||||||
nids[inValue][byID[outValue]] = struct{}{}
|
nids[inValue][byID[outValue]] = struct{}{}
|
||||||
|
@ -1043,8 +1048,6 @@ func (igb *ItemGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range igb.fns {
|
for _, fn := range igb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(igb.fields)+len(igb.fns))
|
columns := make([]string, 0, len(igb.fields)+len(igb.fns))
|
||||||
for _, f := range igb.fields {
|
for _, f := range igb.fields {
|
||||||
|
@ -1064,6 +1067,12 @@ type ItemSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (is *ItemSelect) Aggregate(fns ...AggregateFunc) *ItemSelect {
|
||||||
|
is.fns = append(is.fns, fns...)
|
||||||
|
return is
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (is *ItemSelect) Scan(ctx context.Context, v any) error {
|
func (is *ItemSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := is.prepareQuery(ctx); err != nil {
|
if err := is.prepareQuery(ctx); err != nil {
|
||||||
|
@ -1074,6 +1083,16 @@ func (is *ItemSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (is *ItemSelect) sqlScan(ctx context.Context, v any) error {
|
func (is *ItemSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(is.fns))
|
||||||
|
for _, fn := range is.fns {
|
||||||
|
aggregation = append(aggregation, fn(is.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*is.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
is.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
is.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := is.sql.Query()
|
query, args := is.sql.Query()
|
||||||
if err := is.driver.Query(ctx, query, args, rows); err != nil {
|
if err := is.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -764,257 +764,118 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.UpdatedAt(); ok {
|
if value, ok := iu.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.Name(); ok {
|
if value, ok := iu.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.Description(); ok {
|
if value, ok := iu.mutation.Description(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.DescriptionCleared() {
|
if iu.mutation.DescriptionCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldDescription, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.ImportRefCleared() {
|
if iu.mutation.ImportRefCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldImportRef, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldImportRef,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.Notes(); ok {
|
if value, ok := iu.mutation.Notes(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldNotes, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldNotes,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.NotesCleared() {
|
if iu.mutation.NotesCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldNotes, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldNotes,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.Quantity(); ok {
|
if value, ok := iu.mutation.Quantity(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldQuantity, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldQuantity,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.AddedQuantity(); ok {
|
if value, ok := iu.mutation.AddedQuantity(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(item.FieldQuantity, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldQuantity,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.Insured(); ok {
|
if value, ok := iu.mutation.Insured(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldInsured, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldInsured,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.Archived(); ok {
|
if value, ok := iu.mutation.Archived(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldArchived, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldArchived,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.AssetID(); ok {
|
if value, ok := iu.mutation.AssetID(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldAssetID, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldAssetID,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.AddedAssetID(); ok {
|
if value, ok := iu.mutation.AddedAssetID(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(item.FieldAssetID, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldAssetID,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.SerialNumber(); ok {
|
if value, ok := iu.mutation.SerialNumber(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSerialNumber, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSerialNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.SerialNumberCleared() {
|
if iu.mutation.SerialNumberCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldSerialNumber, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldSerialNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.ModelNumber(); ok {
|
if value, ok := iu.mutation.ModelNumber(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldModelNumber, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldModelNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.ModelNumberCleared() {
|
if iu.mutation.ModelNumberCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldModelNumber, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldModelNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.Manufacturer(); ok {
|
if value, ok := iu.mutation.Manufacturer(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldManufacturer, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldManufacturer,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.ManufacturerCleared() {
|
if iu.mutation.ManufacturerCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldManufacturer, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldManufacturer,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.LifetimeWarranty(); ok {
|
if value, ok := iu.mutation.LifetimeWarranty(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldLifetimeWarranty, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldLifetimeWarranty,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.WarrantyExpires(); ok {
|
if value, ok := iu.mutation.WarrantyExpires(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldWarrantyExpires, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldWarrantyExpires,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.WarrantyExpiresCleared() {
|
if iu.mutation.WarrantyExpiresCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldWarrantyExpires, field.TypeTime)
|
||||||
Type: field.TypeTime,
|
|
||||||
Column: item.FieldWarrantyExpires,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.WarrantyDetails(); ok {
|
if value, ok := iu.mutation.WarrantyDetails(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldWarrantyDetails, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldWarrantyDetails,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.WarrantyDetailsCleared() {
|
if iu.mutation.WarrantyDetailsCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldWarrantyDetails, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldWarrantyDetails,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.PurchaseTime(); ok {
|
if value, ok := iu.mutation.PurchaseTime(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldPurchaseTime, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchaseTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.PurchaseTimeCleared() {
|
if iu.mutation.PurchaseTimeCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldPurchaseTime, field.TypeTime)
|
||||||
Type: field.TypeTime,
|
|
||||||
Column: item.FieldPurchaseTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.PurchaseFrom(); ok {
|
if value, ok := iu.mutation.PurchaseFrom(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldPurchaseFrom, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchaseFrom,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.PurchaseFromCleared() {
|
if iu.mutation.PurchaseFromCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldPurchaseFrom, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldPurchaseFrom,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.PurchasePrice(); ok {
|
if value, ok := iu.mutation.PurchasePrice(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldPurchasePrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchasePrice,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.AddedPurchasePrice(); ok {
|
if value, ok := iu.mutation.AddedPurchasePrice(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(item.FieldPurchasePrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchasePrice,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.SoldTime(); ok {
|
if value, ok := iu.mutation.SoldTime(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldTime, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.SoldTimeCleared() {
|
if iu.mutation.SoldTimeCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldSoldTime, field.TypeTime)
|
||||||
Type: field.TypeTime,
|
|
||||||
Column: item.FieldSoldTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.SoldTo(); ok {
|
if value, ok := iu.mutation.SoldTo(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldTo, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldTo,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.SoldToCleared() {
|
if iu.mutation.SoldToCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldSoldTo, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldSoldTo,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.SoldPrice(); ok {
|
if value, ok := iu.mutation.SoldPrice(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldPrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldPrice,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.AddedSoldPrice(); ok {
|
if value, ok := iu.mutation.AddedSoldPrice(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(item.FieldSoldPrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldPrice,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iu.mutation.SoldNotes(); ok {
|
if value, ok := iu.mutation.SoldNotes(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldNotes, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldNotes,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.SoldNotesCleared() {
|
if iu.mutation.SoldNotesCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldSoldNotes, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldSoldNotes,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iu.mutation.ParentCleared() {
|
if iu.mutation.ParentCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -2116,257 +1977,118 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.UpdatedAt(); ok {
|
if value, ok := iuo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.Name(); ok {
|
if value, ok := iuo.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.Description(); ok {
|
if value, ok := iuo.mutation.Description(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.DescriptionCleared() {
|
if iuo.mutation.DescriptionCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldDescription, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.ImportRefCleared() {
|
if iuo.mutation.ImportRefCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldImportRef, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldImportRef,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.Notes(); ok {
|
if value, ok := iuo.mutation.Notes(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldNotes, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldNotes,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.NotesCleared() {
|
if iuo.mutation.NotesCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldNotes, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldNotes,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.Quantity(); ok {
|
if value, ok := iuo.mutation.Quantity(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldQuantity, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldQuantity,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.AddedQuantity(); ok {
|
if value, ok := iuo.mutation.AddedQuantity(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(item.FieldQuantity, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldQuantity,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.Insured(); ok {
|
if value, ok := iuo.mutation.Insured(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldInsured, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldInsured,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.Archived(); ok {
|
if value, ok := iuo.mutation.Archived(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldArchived, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldArchived,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.AssetID(); ok {
|
if value, ok := iuo.mutation.AssetID(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldAssetID, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldAssetID,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.AddedAssetID(); ok {
|
if value, ok := iuo.mutation.AddedAssetID(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(item.FieldAssetID, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldAssetID,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.SerialNumber(); ok {
|
if value, ok := iuo.mutation.SerialNumber(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSerialNumber, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSerialNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.SerialNumberCleared() {
|
if iuo.mutation.SerialNumberCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldSerialNumber, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldSerialNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.ModelNumber(); ok {
|
if value, ok := iuo.mutation.ModelNumber(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldModelNumber, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldModelNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.ModelNumberCleared() {
|
if iuo.mutation.ModelNumberCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldModelNumber, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldModelNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.Manufacturer(); ok {
|
if value, ok := iuo.mutation.Manufacturer(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldManufacturer, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldManufacturer,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.ManufacturerCleared() {
|
if iuo.mutation.ManufacturerCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldManufacturer, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldManufacturer,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.LifetimeWarranty(); ok {
|
if value, ok := iuo.mutation.LifetimeWarranty(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldLifetimeWarranty, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldLifetimeWarranty,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.WarrantyExpires(); ok {
|
if value, ok := iuo.mutation.WarrantyExpires(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldWarrantyExpires, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldWarrantyExpires,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.WarrantyExpiresCleared() {
|
if iuo.mutation.WarrantyExpiresCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldWarrantyExpires, field.TypeTime)
|
||||||
Type: field.TypeTime,
|
|
||||||
Column: item.FieldWarrantyExpires,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.WarrantyDetails(); ok {
|
if value, ok := iuo.mutation.WarrantyDetails(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldWarrantyDetails, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldWarrantyDetails,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.WarrantyDetailsCleared() {
|
if iuo.mutation.WarrantyDetailsCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldWarrantyDetails, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldWarrantyDetails,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.PurchaseTime(); ok {
|
if value, ok := iuo.mutation.PurchaseTime(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldPurchaseTime, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchaseTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.PurchaseTimeCleared() {
|
if iuo.mutation.PurchaseTimeCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldPurchaseTime, field.TypeTime)
|
||||||
Type: field.TypeTime,
|
|
||||||
Column: item.FieldPurchaseTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.PurchaseFrom(); ok {
|
if value, ok := iuo.mutation.PurchaseFrom(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldPurchaseFrom, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchaseFrom,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.PurchaseFromCleared() {
|
if iuo.mutation.PurchaseFromCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldPurchaseFrom, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldPurchaseFrom,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.PurchasePrice(); ok {
|
if value, ok := iuo.mutation.PurchasePrice(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldPurchasePrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchasePrice,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.AddedPurchasePrice(); ok {
|
if value, ok := iuo.mutation.AddedPurchasePrice(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(item.FieldPurchasePrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldPurchasePrice,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.SoldTime(); ok {
|
if value, ok := iuo.mutation.SoldTime(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldTime, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.SoldTimeCleared() {
|
if iuo.mutation.SoldTimeCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldSoldTime, field.TypeTime)
|
||||||
Type: field.TypeTime,
|
|
||||||
Column: item.FieldSoldTime,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.SoldTo(); ok {
|
if value, ok := iuo.mutation.SoldTo(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldTo, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldTo,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.SoldToCleared() {
|
if iuo.mutation.SoldToCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldSoldTo, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldSoldTo,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.SoldPrice(); ok {
|
if value, ok := iuo.mutation.SoldPrice(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldPrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldPrice,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.AddedSoldPrice(); ok {
|
if value, ok := iuo.mutation.AddedSoldPrice(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(item.FieldSoldPrice, field.TypeFloat64, value)
|
||||||
Type: field.TypeFloat64,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldPrice,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := iuo.mutation.SoldNotes(); ok {
|
if value, ok := iuo.mutation.SoldNotes(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(item.FieldSoldNotes, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: item.FieldSoldNotes,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.SoldNotesCleared() {
|
if iuo.mutation.SoldNotesCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(item.FieldSoldNotes, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: item.FieldSoldNotes,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if iuo.mutation.ParentCleared() {
|
if iuo.mutation.ParentCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -341,75 +341,39 @@ func (ifc *ItemFieldCreate) createSpec() (*ItemField, *sqlgraph.CreateSpec) {
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := ifc.mutation.CreatedAt(); ok {
|
if value, ok := ifc.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := ifc.mutation.UpdatedAt(); ok {
|
if value, ok := ifc.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := ifc.mutation.Name(); ok {
|
if value, ok := ifc.mutation.Name(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldName,
|
|
||||||
})
|
|
||||||
_node.Name = value
|
_node.Name = value
|
||||||
}
|
}
|
||||||
if value, ok := ifc.mutation.Description(); ok {
|
if value, ok := ifc.mutation.Description(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldDescription,
|
|
||||||
})
|
|
||||||
_node.Description = value
|
_node.Description = value
|
||||||
}
|
}
|
||||||
if value, ok := ifc.mutation.GetType(); ok {
|
if value, ok := ifc.mutation.GetType(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldType, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldType,
|
|
||||||
})
|
|
||||||
_node.Type = value
|
_node.Type = value
|
||||||
}
|
}
|
||||||
if value, ok := ifc.mutation.TextValue(); ok {
|
if value, ok := ifc.mutation.TextValue(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldTextValue, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldTextValue,
|
|
||||||
})
|
|
||||||
_node.TextValue = value
|
_node.TextValue = value
|
||||||
}
|
}
|
||||||
if value, ok := ifc.mutation.NumberValue(); ok {
|
if value, ok := ifc.mutation.NumberValue(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldNumberValue, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldNumberValue,
|
|
||||||
})
|
|
||||||
_node.NumberValue = value
|
_node.NumberValue = value
|
||||||
}
|
}
|
||||||
if value, ok := ifc.mutation.BooleanValue(); ok {
|
if value, ok := ifc.mutation.BooleanValue(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldBooleanValue, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldBooleanValue,
|
|
||||||
})
|
|
||||||
_node.BooleanValue = value
|
_node.BooleanValue = value
|
||||||
}
|
}
|
||||||
if value, ok := ifc.mutation.TimeValue(); ok {
|
if value, ok := ifc.mutation.TimeValue(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldTimeValue, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldTimeValue,
|
|
||||||
})
|
|
||||||
_node.TimeValue = value
|
_node.TimeValue = value
|
||||||
}
|
}
|
||||||
if nodes := ifc.mutation.ItemIDs(); len(nodes) > 0 {
|
if nodes := ifc.mutation.ItemIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -333,6 +333,11 @@ func (ifq *ItemFieldQuery) Select(fields ...string) *ItemFieldSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a ItemFieldSelect configured with the given aggregations.
|
||||||
|
func (ifq *ItemFieldQuery) Aggregate(fns ...AggregateFunc) *ItemFieldSelect {
|
||||||
|
return ifq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (ifq *ItemFieldQuery) prepareQuery(ctx context.Context) error {
|
func (ifq *ItemFieldQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range ifq.fields {
|
for _, f := range ifq.fields {
|
||||||
if !itemfield.ValidColumn(f) {
|
if !itemfield.ValidColumn(f) {
|
||||||
|
@ -573,8 +578,6 @@ func (ifgb *ItemFieldGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range ifgb.fns {
|
for _, fn := range ifgb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(ifgb.fields)+len(ifgb.fns))
|
columns := make([]string, 0, len(ifgb.fields)+len(ifgb.fns))
|
||||||
for _, f := range ifgb.fields {
|
for _, f := range ifgb.fields {
|
||||||
|
@ -594,6 +597,12 @@ type ItemFieldSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (ifs *ItemFieldSelect) Aggregate(fns ...AggregateFunc) *ItemFieldSelect {
|
||||||
|
ifs.fns = append(ifs.fns, fns...)
|
||||||
|
return ifs
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (ifs *ItemFieldSelect) Scan(ctx context.Context, v any) error {
|
func (ifs *ItemFieldSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := ifs.prepareQuery(ctx); err != nil {
|
if err := ifs.prepareQuery(ctx); err != nil {
|
||||||
|
@ -604,6 +613,16 @@ func (ifs *ItemFieldSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ifs *ItemFieldSelect) sqlScan(ctx context.Context, v any) error {
|
func (ifs *ItemFieldSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(ifs.fns))
|
||||||
|
for _, fn := range ifs.fns {
|
||||||
|
aggregation = append(aggregation, fn(ifs.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*ifs.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
ifs.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
ifs.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := ifs.sql.Query()
|
query, args := ifs.sql.Query()
|
||||||
if err := ifs.driver.Query(ctx, query, args, rows); err != nil {
|
if err := ifs.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -286,85 +286,40 @@ func (ifu *ItemFieldUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := ifu.mutation.UpdatedAt(); ok {
|
if value, ok := ifu.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifu.mutation.Name(); ok {
|
if value, ok := ifu.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifu.mutation.Description(); ok {
|
if value, ok := ifu.mutation.Description(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ifu.mutation.DescriptionCleared() {
|
if ifu.mutation.DescriptionCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(itemfield.FieldDescription, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: itemfield.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifu.mutation.GetType(); ok {
|
if value, ok := ifu.mutation.GetType(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldType, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldType,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifu.mutation.TextValue(); ok {
|
if value, ok := ifu.mutation.TextValue(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldTextValue, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldTextValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ifu.mutation.TextValueCleared() {
|
if ifu.mutation.TextValueCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(itemfield.FieldTextValue, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: itemfield.FieldTextValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifu.mutation.NumberValue(); ok {
|
if value, ok := ifu.mutation.NumberValue(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldNumberValue, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldNumberValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifu.mutation.AddedNumberValue(); ok {
|
if value, ok := ifu.mutation.AddedNumberValue(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(itemfield.FieldNumberValue, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldNumberValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ifu.mutation.NumberValueCleared() {
|
if ifu.mutation.NumberValueCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(itemfield.FieldNumberValue, field.TypeInt)
|
||||||
Type: field.TypeInt,
|
|
||||||
Column: itemfield.FieldNumberValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifu.mutation.BooleanValue(); ok {
|
if value, ok := ifu.mutation.BooleanValue(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldBooleanValue, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldBooleanValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifu.mutation.TimeValue(); ok {
|
if value, ok := ifu.mutation.TimeValue(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldTimeValue, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldTimeValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ifu.mutation.ItemCleared() {
|
if ifu.mutation.ItemCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -706,85 +661,40 @@ func (ifuo *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := ifuo.mutation.UpdatedAt(); ok {
|
if value, ok := ifuo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifuo.mutation.Name(); ok {
|
if value, ok := ifuo.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifuo.mutation.Description(); ok {
|
if value, ok := ifuo.mutation.Description(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ifuo.mutation.DescriptionCleared() {
|
if ifuo.mutation.DescriptionCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(itemfield.FieldDescription, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: itemfield.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifuo.mutation.GetType(); ok {
|
if value, ok := ifuo.mutation.GetType(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldType, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldType,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifuo.mutation.TextValue(); ok {
|
if value, ok := ifuo.mutation.TextValue(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldTextValue, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldTextValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ifuo.mutation.TextValueCleared() {
|
if ifuo.mutation.TextValueCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(itemfield.FieldTextValue, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: itemfield.FieldTextValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifuo.mutation.NumberValue(); ok {
|
if value, ok := ifuo.mutation.NumberValue(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldNumberValue, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldNumberValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifuo.mutation.AddedNumberValue(); ok {
|
if value, ok := ifuo.mutation.AddedNumberValue(); ok {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.AddField(itemfield.FieldNumberValue, field.TypeInt, value)
|
||||||
Type: field.TypeInt,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldNumberValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ifuo.mutation.NumberValueCleared() {
|
if ifuo.mutation.NumberValueCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(itemfield.FieldNumberValue, field.TypeInt)
|
||||||
Type: field.TypeInt,
|
|
||||||
Column: itemfield.FieldNumberValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifuo.mutation.BooleanValue(); ok {
|
if value, ok := ifuo.mutation.BooleanValue(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldBooleanValue, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldBooleanValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := ifuo.mutation.TimeValue(); ok {
|
if value, ok := ifuo.mutation.TimeValue(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(itemfield.FieldTimeValue, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: itemfield.FieldTimeValue,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ifuo.mutation.ItemCleared() {
|
if ifuo.mutation.ItemCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -282,43 +282,23 @@ func (lc *LabelCreate) createSpec() (*Label, *sqlgraph.CreateSpec) {
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := lc.mutation.CreatedAt(); ok {
|
if value, ok := lc.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := lc.mutation.UpdatedAt(); ok {
|
if value, ok := lc.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := lc.mutation.Name(); ok {
|
if value, ok := lc.mutation.Name(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldName,
|
|
||||||
})
|
|
||||||
_node.Name = value
|
_node.Name = value
|
||||||
}
|
}
|
||||||
if value, ok := lc.mutation.Description(); ok {
|
if value, ok := lc.mutation.Description(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldDescription,
|
|
||||||
})
|
|
||||||
_node.Description = value
|
_node.Description = value
|
||||||
}
|
}
|
||||||
if value, ok := lc.mutation.Color(); ok {
|
if value, ok := lc.mutation.Color(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldColor, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldColor,
|
|
||||||
})
|
|
||||||
_node.Color = value
|
_node.Color = value
|
||||||
}
|
}
|
||||||
if nodes := lc.mutation.GroupIDs(); len(nodes) > 0 {
|
if nodes := lc.mutation.GroupIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -370,6 +370,11 @@ func (lq *LabelQuery) Select(fields ...string) *LabelSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a LabelSelect configured with the given aggregations.
|
||||||
|
func (lq *LabelQuery) Aggregate(fns ...AggregateFunc) *LabelSelect {
|
||||||
|
return lq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (lq *LabelQuery) prepareQuery(ctx context.Context) error {
|
func (lq *LabelQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range lq.fields {
|
for _, f := range lq.fields {
|
||||||
if !label.ValidColumn(f) {
|
if !label.ValidColumn(f) {
|
||||||
|
@ -502,7 +507,7 @@ func (lq *LabelQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*
|
||||||
outValue := *values[0].(*uuid.UUID)
|
outValue := *values[0].(*uuid.UUID)
|
||||||
inValue := *values[1].(*uuid.UUID)
|
inValue := *values[1].(*uuid.UUID)
|
||||||
if nids[inValue] == nil {
|
if nids[inValue] == nil {
|
||||||
nids[inValue] = map[*Label]struct{}{byID[outValue]: struct{}{}}
|
nids[inValue] = map[*Label]struct{}{byID[outValue]: {}}
|
||||||
return assign(columns[1:], values[1:])
|
return assign(columns[1:], values[1:])
|
||||||
}
|
}
|
||||||
nids[inValue][byID[outValue]] = struct{}{}
|
nids[inValue][byID[outValue]] = struct{}{}
|
||||||
|
@ -676,8 +681,6 @@ func (lgb *LabelGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range lgb.fns {
|
for _, fn := range lgb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(lgb.fields)+len(lgb.fns))
|
columns := make([]string, 0, len(lgb.fields)+len(lgb.fns))
|
||||||
for _, f := range lgb.fields {
|
for _, f := range lgb.fields {
|
||||||
|
@ -697,6 +700,12 @@ type LabelSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (ls *LabelSelect) Aggregate(fns ...AggregateFunc) *LabelSelect {
|
||||||
|
ls.fns = append(ls.fns, fns...)
|
||||||
|
return ls
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (ls *LabelSelect) Scan(ctx context.Context, v any) error {
|
func (ls *LabelSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := ls.prepareQuery(ctx); err != nil {
|
if err := ls.prepareQuery(ctx); err != nil {
|
||||||
|
@ -707,6 +716,16 @@ func (ls *LabelSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LabelSelect) sqlScan(ctx context.Context, v any) error {
|
func (ls *LabelSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(ls.fns))
|
||||||
|
for _, fn := range ls.fns {
|
||||||
|
aggregation = append(aggregation, fn(ls.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*ls.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
ls.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
ls.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := ls.sql.Query()
|
query, args := ls.sql.Query()
|
||||||
if err := ls.driver.Query(ctx, query, args, rows); err != nil {
|
if err := ls.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -252,44 +252,22 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := lu.mutation.UpdatedAt(); ok {
|
if value, ok := lu.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := lu.mutation.Name(); ok {
|
if value, ok := lu.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := lu.mutation.Description(); ok {
|
if value, ok := lu.mutation.Description(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if lu.mutation.DescriptionCleared() {
|
if lu.mutation.DescriptionCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(label.FieldDescription, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: label.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := lu.mutation.Color(); ok {
|
if value, ok := lu.mutation.Color(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldColor, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldColor,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if lu.mutation.ColorCleared() {
|
if lu.mutation.ColorCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(label.FieldColor, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: label.FieldColor,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if lu.mutation.GroupCleared() {
|
if lu.mutation.GroupCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -650,44 +628,22 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := luo.mutation.UpdatedAt(); ok {
|
if value, ok := luo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := luo.mutation.Name(); ok {
|
if value, ok := luo.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := luo.mutation.Description(); ok {
|
if value, ok := luo.mutation.Description(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if luo.mutation.DescriptionCleared() {
|
if luo.mutation.DescriptionCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(label.FieldDescription, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: label.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := luo.mutation.Color(); ok {
|
if value, ok := luo.mutation.Color(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(label.FieldColor, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: label.FieldColor,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if luo.mutation.ColorCleared() {
|
if luo.mutation.ColorCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(label.FieldColor, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: label.FieldColor,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if luo.mutation.GroupCleared() {
|
if luo.mutation.GroupCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -297,35 +297,19 @@ func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) {
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := lc.mutation.CreatedAt(); ok {
|
if value, ok := lc.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := lc.mutation.UpdatedAt(); ok {
|
if value, ok := lc.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := lc.mutation.Name(); ok {
|
if value, ok := lc.mutation.Name(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldName,
|
|
||||||
})
|
|
||||||
_node.Name = value
|
_node.Name = value
|
||||||
}
|
}
|
||||||
if value, ok := lc.mutation.Description(); ok {
|
if value, ok := lc.mutation.Description(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldDescription,
|
|
||||||
})
|
|
||||||
_node.Description = value
|
_node.Description = value
|
||||||
}
|
}
|
||||||
if nodes := lc.mutation.ParentIDs(); len(nodes) > 0 {
|
if nodes := lc.mutation.ParentIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -440,6 +440,11 @@ func (lq *LocationQuery) Select(fields ...string) *LocationSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a LocationSelect configured with the given aggregations.
|
||||||
|
func (lq *LocationQuery) Aggregate(fns ...AggregateFunc) *LocationSelect {
|
||||||
|
return lq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (lq *LocationQuery) prepareQuery(ctx context.Context) error {
|
func (lq *LocationQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range lq.fields {
|
for _, f := range lq.fields {
|
||||||
if !location.ValidColumn(f) {
|
if !location.ValidColumn(f) {
|
||||||
|
@ -794,8 +799,6 @@ func (lgb *LocationGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range lgb.fns {
|
for _, fn := range lgb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(lgb.fields)+len(lgb.fns))
|
columns := make([]string, 0, len(lgb.fields)+len(lgb.fns))
|
||||||
for _, f := range lgb.fields {
|
for _, f := range lgb.fields {
|
||||||
|
@ -815,6 +818,12 @@ type LocationSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (ls *LocationSelect) Aggregate(fns ...AggregateFunc) *LocationSelect {
|
||||||
|
ls.fns = append(ls.fns, fns...)
|
||||||
|
return ls
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (ls *LocationSelect) Scan(ctx context.Context, v any) error {
|
func (ls *LocationSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := ls.prepareQuery(ctx); err != nil {
|
if err := ls.prepareQuery(ctx); err != nil {
|
||||||
|
@ -825,6 +834,16 @@ func (ls *LocationSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LocationSelect) sqlScan(ctx context.Context, v any) error {
|
func (ls *LocationSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(ls.fns))
|
||||||
|
for _, fn := range ls.fns {
|
||||||
|
aggregation = append(aggregation, fn(ls.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*ls.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
ls.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
ls.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := ls.sql.Query()
|
query, args := ls.sql.Query()
|
||||||
if err := ls.driver.Query(ctx, query, args, rows); err != nil {
|
if err := ls.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -288,31 +288,16 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := lu.mutation.UpdatedAt(); ok {
|
if value, ok := lu.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := lu.mutation.Name(); ok {
|
if value, ok := lu.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := lu.mutation.Description(); ok {
|
if value, ok := lu.mutation.Description(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if lu.mutation.DescriptionCleared() {
|
if lu.mutation.DescriptionCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(location.FieldDescription, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: location.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if lu.mutation.ParentCleared() {
|
if lu.mutation.ParentCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -798,31 +783,16 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := luo.mutation.UpdatedAt(); ok {
|
if value, ok := luo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := luo.mutation.Name(); ok {
|
if value, ok := luo.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := luo.mutation.Description(); ok {
|
if value, ok := luo.mutation.Description(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(location.FieldDescription, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: location.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if luo.mutation.DescriptionCleared() {
|
if luo.mutation.DescriptionCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(location.FieldDescription, field.TypeString)
|
||||||
Type: field.TypeString,
|
|
||||||
Column: location.FieldDescription,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if luo.mutation.ParentCleared() {
|
if luo.mutation.ParentCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -127,7 +127,7 @@ var (
|
||||||
{Name: "created_at", Type: field.TypeTime},
|
{Name: "created_at", Type: field.TypeTime},
|
||||||
{Name: "updated_at", Type: field.TypeTime},
|
{Name: "updated_at", Type: field.TypeTime},
|
||||||
{Name: "name", Type: field.TypeString, Size: 255},
|
{Name: "name", Type: field.TypeString, Size: 255},
|
||||||
{Name: "currency", Type: field.TypeEnum, Enums: []string{"usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr"}, Default: "usd"},
|
{Name: "currency", Type: field.TypeEnum, Enums: []string{"usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr", "rmb"}, Default: "usd"},
|
||||||
}
|
}
|
||||||
// GroupsTable holds the schema information for the "groups" table.
|
// GroupsTable holds the schema information for the "groups" table.
|
||||||
GroupsTable = &schema.Table{
|
GroupsTable = &schema.Table{
|
||||||
|
|
|
@ -5,6 +5,6 @@ package runtime
|
||||||
// The schema-stitching logic is generated in github.com/hay-kot/homebox/backend/internal/data/ent/runtime.go
|
// The schema-stitching logic is generated in github.com/hay-kot/homebox/backend/internal/data/ent/runtime.go
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "v0.11.3" // Version of ent codegen.
|
Version = "v0.11.4" // Version of ent codegen.
|
||||||
Sum = "h1:F5FBGAWiDCGder7YT+lqMnyzXl6d0xU3xMBM/SO3CMc=" // Sum of ent codegen.
|
Sum = "h1:grwVY0fp31BZ6oEo3YrXenAuv8VJmEw7F/Bi6WqeH3Q=" // Sum of ent codegen.
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@ func (Group) Fields() []ent.Field {
|
||||||
NotEmpty(),
|
NotEmpty(),
|
||||||
field.Enum("currency").
|
field.Enum("currency").
|
||||||
Default("usd").
|
Default("usd").
|
||||||
Values("usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr"),
|
Values("usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr", "rmb"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,6 @@ type Tx struct {
|
||||||
// lazily loaded.
|
// lazily loaded.
|
||||||
client *Client
|
client *Client
|
||||||
clientOnce sync.Once
|
clientOnce sync.Once
|
||||||
|
|
||||||
// completion callbacks.
|
|
||||||
mu sync.Mutex
|
|
||||||
onCommit []CommitHook
|
|
||||||
onRollback []RollbackHook
|
|
||||||
|
|
||||||
// ctx lives for the life of the transaction. It is
|
// ctx lives for the life of the transaction. It is
|
||||||
// the same context used by the underlying connection.
|
// the same context used by the underlying connection.
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
|
@ -88,9 +82,9 @@ func (tx *Tx) Commit() error {
|
||||||
var fn Committer = CommitFunc(func(context.Context, *Tx) error {
|
var fn Committer = CommitFunc(func(context.Context, *Tx) error {
|
||||||
return txDriver.tx.Commit()
|
return txDriver.tx.Commit()
|
||||||
})
|
})
|
||||||
tx.mu.Lock()
|
txDriver.mu.Lock()
|
||||||
hooks := append([]CommitHook(nil), tx.onCommit...)
|
hooks := append([]CommitHook(nil), txDriver.onCommit...)
|
||||||
tx.mu.Unlock()
|
txDriver.mu.Unlock()
|
||||||
for i := len(hooks) - 1; i >= 0; i-- {
|
for i := len(hooks) - 1; i >= 0; i-- {
|
||||||
fn = hooks[i](fn)
|
fn = hooks[i](fn)
|
||||||
}
|
}
|
||||||
|
@ -99,9 +93,10 @@ func (tx *Tx) Commit() error {
|
||||||
|
|
||||||
// OnCommit adds a hook to call on commit.
|
// OnCommit adds a hook to call on commit.
|
||||||
func (tx *Tx) OnCommit(f CommitHook) {
|
func (tx *Tx) OnCommit(f CommitHook) {
|
||||||
tx.mu.Lock()
|
txDriver := tx.config.driver.(*txDriver)
|
||||||
defer tx.mu.Unlock()
|
txDriver.mu.Lock()
|
||||||
tx.onCommit = append(tx.onCommit, f)
|
txDriver.onCommit = append(txDriver.onCommit, f)
|
||||||
|
txDriver.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -143,9 +138,9 @@ func (tx *Tx) Rollback() error {
|
||||||
var fn Rollbacker = RollbackFunc(func(context.Context, *Tx) error {
|
var fn Rollbacker = RollbackFunc(func(context.Context, *Tx) error {
|
||||||
return txDriver.tx.Rollback()
|
return txDriver.tx.Rollback()
|
||||||
})
|
})
|
||||||
tx.mu.Lock()
|
txDriver.mu.Lock()
|
||||||
hooks := append([]RollbackHook(nil), tx.onRollback...)
|
hooks := append([]RollbackHook(nil), txDriver.onRollback...)
|
||||||
tx.mu.Unlock()
|
txDriver.mu.Unlock()
|
||||||
for i := len(hooks) - 1; i >= 0; i-- {
|
for i := len(hooks) - 1; i >= 0; i-- {
|
||||||
fn = hooks[i](fn)
|
fn = hooks[i](fn)
|
||||||
}
|
}
|
||||||
|
@ -154,9 +149,10 @@ func (tx *Tx) Rollback() error {
|
||||||
|
|
||||||
// OnRollback adds a hook to call on rollback.
|
// OnRollback adds a hook to call on rollback.
|
||||||
func (tx *Tx) OnRollback(f RollbackHook) {
|
func (tx *Tx) OnRollback(f RollbackHook) {
|
||||||
tx.mu.Lock()
|
txDriver := tx.config.driver.(*txDriver)
|
||||||
defer tx.mu.Unlock()
|
txDriver.mu.Lock()
|
||||||
tx.onRollback = append(tx.onRollback, f)
|
txDriver.onRollback = append(txDriver.onRollback, f)
|
||||||
|
txDriver.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client returns a Client that binds to current transaction.
|
// Client returns a Client that binds to current transaction.
|
||||||
|
@ -198,6 +194,10 @@ type txDriver struct {
|
||||||
drv dialect.Driver
|
drv dialect.Driver
|
||||||
// tx is the underlying transaction.
|
// tx is the underlying transaction.
|
||||||
tx dialect.Tx
|
tx dialect.Tx
|
||||||
|
// completion hooks.
|
||||||
|
mu sync.Mutex
|
||||||
|
onCommit []CommitHook
|
||||||
|
onRollback []RollbackHook
|
||||||
}
|
}
|
||||||
|
|
||||||
// newTx creates a new transactional driver.
|
// newTx creates a new transactional driver.
|
||||||
|
|
|
@ -354,75 +354,39 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
|
||||||
_spec.ID.Value = &id
|
_spec.ID.Value = &id
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.CreatedAt(); ok {
|
if value, ok := uc.mutation.CreatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldCreatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldCreatedAt,
|
|
||||||
})
|
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.UpdatedAt(); ok {
|
if value, ok := uc.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.Name(); ok {
|
if value, ok := uc.mutation.Name(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldName,
|
|
||||||
})
|
|
||||||
_node.Name = value
|
_node.Name = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.Email(); ok {
|
if value, ok := uc.mutation.Email(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldEmail, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldEmail,
|
|
||||||
})
|
|
||||||
_node.Email = value
|
_node.Email = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.Password(); ok {
|
if value, ok := uc.mutation.Password(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldPassword, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldPassword,
|
|
||||||
})
|
|
||||||
_node.Password = value
|
_node.Password = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.IsSuperuser(); ok {
|
if value, ok := uc.mutation.IsSuperuser(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldIsSuperuser, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldIsSuperuser,
|
|
||||||
})
|
|
||||||
_node.IsSuperuser = value
|
_node.IsSuperuser = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.Role(); ok {
|
if value, ok := uc.mutation.Role(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldRole, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldRole,
|
|
||||||
})
|
|
||||||
_node.Role = value
|
_node.Role = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.Superuser(); ok {
|
if value, ok := uc.mutation.Superuser(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldSuperuser, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldSuperuser,
|
|
||||||
})
|
|
||||||
_node.Superuser = value
|
_node.Superuser = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.ActivatedOn(); ok {
|
if value, ok := uc.mutation.ActivatedOn(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldActivatedOn, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldActivatedOn,
|
|
||||||
})
|
|
||||||
_node.ActivatedOn = value
|
_node.ActivatedOn = value
|
||||||
}
|
}
|
||||||
if nodes := uc.mutation.GroupIDs(); len(nodes) > 0 {
|
if nodes := uc.mutation.GroupIDs(); len(nodes) > 0 {
|
||||||
|
|
|
@ -370,6 +370,11 @@ func (uq *UserQuery) Select(fields ...string) *UserSelect {
|
||||||
return selbuild
|
return selbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a UserSelect configured with the given aggregations.
|
||||||
|
func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect {
|
||||||
|
return uq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
func (uq *UserQuery) prepareQuery(ctx context.Context) error {
|
func (uq *UserQuery) prepareQuery(ctx context.Context) error {
|
||||||
for _, f := range uq.fields {
|
for _, f := range uq.fields {
|
||||||
if !user.ValidColumn(f) {
|
if !user.ValidColumn(f) {
|
||||||
|
@ -649,8 +654,6 @@ func (ugb *UserGroupBy) sqlQuery() *sql.Selector {
|
||||||
for _, fn := range ugb.fns {
|
for _, fn := range ugb.fns {
|
||||||
aggregation = append(aggregation, fn(selector))
|
aggregation = append(aggregation, fn(selector))
|
||||||
}
|
}
|
||||||
// If no columns were selected in a custom aggregation function, the default
|
|
||||||
// selection is the fields used for "group-by", and the aggregation functions.
|
|
||||||
if len(selector.SelectedColumns()) == 0 {
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
columns := make([]string, 0, len(ugb.fields)+len(ugb.fns))
|
columns := make([]string, 0, len(ugb.fields)+len(ugb.fns))
|
||||||
for _, f := range ugb.fields {
|
for _, f := range ugb.fields {
|
||||||
|
@ -670,6 +673,12 @@ type UserSelect struct {
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect {
|
||||||
|
us.fns = append(us.fns, fns...)
|
||||||
|
return us
|
||||||
|
}
|
||||||
|
|
||||||
// Scan applies the selector query and scans the result into the given value.
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
func (us *UserSelect) Scan(ctx context.Context, v any) error {
|
func (us *UserSelect) Scan(ctx context.Context, v any) error {
|
||||||
if err := us.prepareQuery(ctx); err != nil {
|
if err := us.prepareQuery(ctx); err != nil {
|
||||||
|
@ -680,6 +689,16 @@ func (us *UserSelect) Scan(ctx context.Context, v any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (us *UserSelect) sqlScan(ctx context.Context, v any) error {
|
func (us *UserSelect) sqlScan(ctx context.Context, v any) error {
|
||||||
|
aggregation := make([]string, 0, len(us.fns))
|
||||||
|
for _, fn := range us.fns {
|
||||||
|
aggregation = append(aggregation, fn(us.sql))
|
||||||
|
}
|
||||||
|
switch n := len(*us.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
us.sql.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
us.sql.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
rows := &sql.Rows{}
|
rows := &sql.Rows{}
|
||||||
query, args := us.sql.Query()
|
query, args := us.sql.Query()
|
||||||
if err := us.driver.Query(ctx, query, args, rows); err != nil {
|
if err := us.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
|
|
@ -291,66 +291,31 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := uu.mutation.UpdatedAt(); ok {
|
if value, ok := uu.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uu.mutation.Name(); ok {
|
if value, ok := uu.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uu.mutation.Email(); ok {
|
if value, ok := uu.mutation.Email(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldEmail, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldEmail,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uu.mutation.Password(); ok {
|
if value, ok := uu.mutation.Password(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldPassword, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldPassword,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uu.mutation.IsSuperuser(); ok {
|
if value, ok := uu.mutation.IsSuperuser(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldIsSuperuser, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldIsSuperuser,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uu.mutation.Role(); ok {
|
if value, ok := uu.mutation.Role(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldRole, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldRole,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uu.mutation.Superuser(); ok {
|
if value, ok := uu.mutation.Superuser(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldSuperuser, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldSuperuser,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uu.mutation.ActivatedOn(); ok {
|
if value, ok := uu.mutation.ActivatedOn(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldActivatedOn, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldActivatedOn,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if uu.mutation.ActivatedOnCleared() {
|
if uu.mutation.ActivatedOnCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(user.FieldActivatedOn, field.TypeTime)
|
||||||
Type: field.TypeTime,
|
|
||||||
Column: user.FieldActivatedOn,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if uu.mutation.GroupCleared() {
|
if uu.mutation.GroupCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
@ -750,66 +715,31 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value, ok := uuo.mutation.UpdatedAt(); ok {
|
if value, ok := uuo.mutation.UpdatedAt(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldUpdatedAt, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldUpdatedAt,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uuo.mutation.Name(); ok {
|
if value, ok := uuo.mutation.Name(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldName, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldName,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uuo.mutation.Email(); ok {
|
if value, ok := uuo.mutation.Email(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldEmail, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldEmail,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uuo.mutation.Password(); ok {
|
if value, ok := uuo.mutation.Password(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldPassword, field.TypeString, value)
|
||||||
Type: field.TypeString,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldPassword,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uuo.mutation.IsSuperuser(); ok {
|
if value, ok := uuo.mutation.IsSuperuser(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldIsSuperuser, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldIsSuperuser,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uuo.mutation.Role(); ok {
|
if value, ok := uuo.mutation.Role(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldRole, field.TypeEnum, value)
|
||||||
Type: field.TypeEnum,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldRole,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uuo.mutation.Superuser(); ok {
|
if value, ok := uuo.mutation.Superuser(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldSuperuser, field.TypeBool, value)
|
||||||
Type: field.TypeBool,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldSuperuser,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if value, ok := uuo.mutation.ActivatedOn(); ok {
|
if value, ok := uuo.mutation.ActivatedOn(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.SetField(user.FieldActivatedOn, field.TypeTime, value)
|
||||||
Type: field.TypeTime,
|
|
||||||
Value: value,
|
|
||||||
Column: user.FieldActivatedOn,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if uuo.mutation.ActivatedOnCleared() {
|
if uuo.mutation.ActivatedOnCleared() {
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.ClearField(user.FieldActivatedOn, field.TypeTime)
|
||||||
Type: field.TypeTime,
|
|
||||||
Column: user.FieldActivatedOn,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if uuo.mutation.GroupCleared() {
|
if uuo.mutation.GroupCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export type Codes = "USD" | "EUR" | "GBP" | "JPY" | "ZAR" | "AUD" | "NOK" | "SEK" | "DKK" | "INR";
|
export type Codes = "USD" | "EUR" | "GBP" | "JPY" | "ZAR" | "AUD" | "NOK" | "SEK" | "DKK" | "INR" | "RMB";
|
||||||
|
|
||||||
export type Currency = {
|
export type Currency = {
|
||||||
code: Codes;
|
code: Codes;
|
||||||
|
@ -20,6 +20,12 @@ export const currencies: Currency[] = [
|
||||||
symbol: "£",
|
symbol: "£",
|
||||||
name: "British Pound",
|
name: "British Pound",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
code: "RMB",
|
||||||
|
local: "zh-CN",
|
||||||
|
symbol: "¥",
|
||||||
|
name: "Chinese Yuan",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
code: "DKK",
|
code: "DKK",
|
||||||
local: "da-DK",
|
local: "da-DK",
|
||||||
|
|
Loading…
Reference in a new issue