wgorm

package module
v0.0.0-...-f53ad49 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Unlicense Imports: 9 Imported by: 0

README

wgorm

this is a personal project trying to wrap gorm to make it more convenient to use

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	Create(ctx context.Context, value interface{}) error
	BatchCreate(ctx context.Context, value interface{}) error

	MustGet(ctx context.Context, result interface{}, id interface{}, opts ...Option) error
	MGet(ctx context.Context, result interface{}, ids []interface{}, opts ...Option) error
	Search(ctx context.Context, result interface{}, where interface{}, opts ...Option) error

	Update(ctx context.Context, value interface{}, update interface{}, where interface{}) (int64, error)
	UpdateByID(ctx context.Context, value interface{}, update interface{}, id interface{}) (int64, error)
	Save(ctx context.Context, value interface{}) (int64, error)

	Delete(ctx context.Context, value interface{}, where interface{}) (int64, error)
	DeleteByID(ctx context.Context, value interface{}, id interface{}) (int64, error)

	// transaction
	Begin(ctx context.Context) (context.Context, *gorm.DB, error)
	CommitORRollback(ctx context.Context, err error, panicRecover interface{}) (context.Context, error)
}

func NewExecutor

func NewExecutor(dsn string) (Executor, error)

type Option

type Option struct {
	Offset int
	Limit  int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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