Documentation
¶
Index ¶
- Variables
- func Ctx(ctx context.Context, db *gorm.DB) context.Context
- func CtxNew(ctx context.Context) context.Context
- func DBAll[T DBModelID](db *gorm.DB, cb func(T) error) error
- func ExecuteSQLFilesFromEmbed(ctx context.Context, fs embed.FS, dir string) error
- func For(ctx context.Context) *gorm.DB
- func GenID(ctx context.Context, name string) (int64, error)
- func Loader[T any](column string, key func(T) string, options ...dataloadgen.Option) *dataloadgen.Loader[string, T]
- func LoaderCtx[T any](column string, key func(context.Context, T) string, ...) *dataloadgen.Loader[string, T]
- func LoaderCtxs[T any](columns []string, key func(context.Context, T) []string, ...) *dataloadgen.Loader[string, T]
- func Loaders[T any](columns []string, key func(T) []string, options ...dataloadgen.Option) *dataloadgen.Loader[string, T]
- func LoadersKey(keys ...string) string
- func NewLoggerOp(logger logger.Interface) func(*gorm.Config)
- func Tx(ctx context.Context, f func(context.Context) error, opts ...*sql.TxOptions) error
- func WhereCtx(ctx context.Context, query string, args ...any) context.Context
- type Array
- type Config
- type DBModelID
- type IDGen
- type Map
- type Model
- type Option
- type SQLExecutionHistory
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = fmt.Errorf("not found") ErrKey = fmt.Errorf("invalid key format") )
Functions ¶
func ExecuteSQLFilesFromEmbed ¶
ExecuteSQLFilesFromEmbed reads SQL files from an embedded directory and executes them if not already executed. Uses a transaction to ensure atomicity of SQL execution and history recording.
func GenID ¶
Gen generates a new ID for the given name Uses Upsert to atomically increment the sequence number
func Loader ¶
func Loader[T any](column string, key func(T) string, options ...dataloadgen.Option) *dataloadgen.Loader[string, T]
func LoaderCtx ¶
func LoaderCtx[T any](column string, key func(context.Context, T) string, options ...dataloadgen.Option) *dataloadgen.Loader[string, T]
func LoaderCtxs ¶
func LoaderCtxs[T any](columns []string, key func(context.Context, T) []string, options ...dataloadgen.Option) *dataloadgen.Loader[string, T]
func Loaders ¶
func Loaders[T any](columns []string, key func(T) []string, options ...dataloadgen.Option) *dataloadgen.Loader[string, T]
func LoadersKey ¶
Types ¶
type Config ¶
type Map ¶
type Map[K comparable, T any] map[K]T
type Model ¶
type SQLExecutionHistory ¶
Click to show internal directories.
Click to hide internal directories.