.gitignore | ||
go.mod | ||
go.sum | ||
README.md | ||
xid.go |
xidgql
xid graphql gqlgen marshaller and unmarshaller also in combination with ent.
In gqlgen.yml
models:
ID:
model:
- code.icod.de/dalu/xidgql/xidgql.ID
as an ID field in an ent schema
package schema
import (
"github.com/rs/xid"
)
// Fields of the Model.
func (Model) Fields() []ent.Field {
return []ent.Field{
field.String("id").
GoType(xid.ID{}).
DefaultFunc(xid.New).
Annotations(
entsql.Annotation{Size: 12},
).
Unique(),
}
}