repo

package
v0.0.0-...-dcec590 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create[R Record](ctx context.Context, r R) error

func FindById

func FindById[R Record](ctx context.Context, obj R, id string) error

func Init

func Init(ctx context.Context, cfg *Config) error

func NewWriteTx

func NewWriteTx(ctx context.Context, fn func(ctx context.Context) error) error

func OpenDB

func OpenDB(cfg *Config) (*gorm.DB, error)

func RegisterType

func RegisterType[R Record]() error

func RequiresWriteTx

func RequiresWriteTx(ctx context.Context) (*gorm.DB, error)

func WriteTx1

func WriteTx1(ctx context.Context, fn func(ctx context.Context) error) error

Types

type Config

type Config struct {
	Driver string
	Dsn    string
	Debug  bool
}

type ErrUnsupportedDriver

type ErrUnsupportedDriver struct {
	// contains filtered or unexported fields
}

func (*ErrUnsupportedDriver) Error

func (e *ErrUnsupportedDriver) Error() string

type IdAutoGenerator

type IdAutoGenerator interface {
	Record
	SetId(id string)
}

type ReadCtx

type ReadCtx struct {
	context.Context
	// contains filtered or unexported fields
}

type Record

type Record interface {
	Id() string
	IdFieldName() string
}

type WriteCtx

type WriteCtx struct {
	ReadCtx
}

Jump to

Keyboard shortcuts

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