modelsutils

package
v0.20.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client() *modelgen.Client

Client returns the client.

func Connect

func Connect() (err error)

Connect to the database and create the client.

func MarshalUUID

func MarshalUUID(uuid uuid.UUID) graphql.Marshaler

Function for converting a time-object to an RFC3339-String with GraphQL. Returns the corresponding marshaller to perform this task.

func Migrate

func Migrate() (err error)

Migrate migrates the schema of the database.

func TranslateFlagFromORM

func TranslateFlagFromORM(flags []string) []typesgen.Flag

TranslateORMToFlag converts a slice of string to a slice of Flag. The string slice must be in the same format as the ORM.

func TranslateFlagToORM

func TranslateFlagToORM(flags ...typesgen.Flag) []string

TranslateFlagToORM converts a slice of Flag to a slice of string that can be used in ORM.

func UnmarshalUUID

func UnmarshalUUID(v interface{}) (uuid.UUID, error)

Function for converting a RFC3339 Time-String into an time-object. Used by GraphQL. Returns a Time-Object representing the Time-String.

func UserFirstOrCreateFromComplexLocation

func UserFirstOrCreateFromComplexLocation(ctx context.Context, l *duoapi.Location[duoapi.ComplexLocationUser]) (*modelgen.User, error)

func UserFirstOrCreateFromLocation

func UserFirstOrCreateFromLocation(ctx context.Context, l *duoapi.Location[duoapi.LocationUser]) (*modelgen.User, error)

func WithTx

func WithTx(ctx context.Context, client *modelgen.Client, fn func(tx *modelgen.Tx) error) error

WithTx is a helper function to wrap a function call with a transaction. If the function returns an error, the transaction is rolled back. If the function returns nil, the transaction is committed. See https://entgo.io/docs/transactions/#best-practices

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL