schema/field: support unique bytes (#1720)

This commit is contained in:
Tarrence van As
2021-07-20 00:24:38 -07:00
committed by GitHub
parent 756517e559
commit dfc7a79f6d
5 changed files with 18 additions and 9 deletions

View File

@@ -19,8 +19,8 @@ func ({{ $receiver }} *{{ $builder }}) sqlSave(ctx context.Context) (*{{ $.Name
}
return nil, err
}
{{- if and $.ID.UserDefined (or $.ID.IsString $.ID.IsUUID) }}
{{- /* Do nothing, because these 2 types must be supplied by the user. */ -}}
{{- if and $.ID.UserDefined (or $.ID.IsString $.ID.IsUUID $.ID.IsBytes) }}
{{- /* Do nothing, because these 3 types must be supplied by the user. */ -}}
{{- else }}
{{- if $.ID.UserDefined }}
if _node.ID == 0 {
@@ -125,7 +125,7 @@ func ({{ $receiver }} *{{ $builder }}) Save(ctx context.Context) ([]*{{ $.Name }
}
mutation.{{ $.ID.BuilderField }} = &nodes[i].{{ $.ID.StructField }}
mutation.done = true
{{- if and $.ID.UserDefined (or $.ID.IsString $.ID.IsUUID) }}
{{- if and $.ID.UserDefined (or $.ID.IsString $.ID.IsUUID $.ID.IsBytes) }}
{{- /* Do nothing, because these 2 types must be supplied by the user. */ -}}
{{- else }}
{{- if $.ID.UserDefined }}