gorm

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 13 Imported by: 6

Documentation

Index

Constants

View Source
const DefaultLimit = 1000

Variables

This section is empty.

Functions

func Conditions

func Conditions(db *gorm.DB, conditions *selection_condition.SelectionCondition) *gorm.DB

func Limit

func Limit(db *gorm.DB, value uint) *gorm.DB

func Offset

func Offset(db *gorm.DB, value uint) *gorm.DB

func SortOrder

func SortOrder(db *gorm.DB, orders []map[string]string) *gorm.DB

func Where

func Where(db *gorm.DB, conditions interface{}) *gorm.DB

func WhereCondition

func WhereCondition(db *gorm.DB, condition selection_condition.WhereCondition) *gorm.DB

func WhereConditions

func WhereConditions(db *gorm.DB, conditions selection_condition.WhereConditions) *gorm.DB

Types

type Config

type Config struct {
	Dialect       string
	DSN           string
	IsAutoMigrate bool
	Log           LogConfig
}

Config for a DB connection

type DB

type DB struct {
	GormDB *gorm.DB
	// contains filtered or unexported fields
}

DB is the struct for a DB connection

func New

func New(logger log.ILogger, conf Config) (*DB, error)

New creates a new DB connection

func (*DB) Close added in v0.0.7

func (db *DB) Close() error

func (*DB) DB

func (db *DB) DB() *gorm.DB

func (*DB) GormTx added in v0.0.14

func (db *DB) GormTx(gormDB *gorm.DB) *gorm.DB

func (*DB) IsAutoMigrate

func (db *DB) IsAutoMigrate() bool

func (*DB) Model added in v0.0.9

func (db *DB) Model(value interface{}) (*DB, error)

func (*DB) ModelWithContext added in v0.0.10

func (db *DB) ModelWithContext(ctx context.Context, model interface{}) (*DB, error)

func (*DB) SchemeInit added in v0.0.11

func (db *DB) SchemeInit(model interface{}) (*DB, error)

func (*DB) SchemeInitWithContext added in v0.0.11

func (db *DB) SchemeInitWithContext(ctx context.Context, model interface{}) (*DB, error)

func (*DB) WithContext added in v0.0.9

func (db *DB) WithContext(ctx context.Context) *DB

type IDB

type IDB interface {
	DB() *gorm.DB
	Close() error
	IsAutoMigrate() bool
	Model(value interface{}) (*DB, error)
	WithContext(ctx context.Context) *DB
	ModelWithContext(ctx context.Context, model interface{}) (*DB, error)
	SchemeInit(model interface{}) (*DB, error)
	SchemeInitWithContext(ctx context.Context, model interface{}) (*DB, error)
	GormTx(gormDB *gorm.DB) *gorm.DB
}

IDB is the interface for a DB connection

type LogConfig added in v0.0.4

type LogConfig struct {
	SlowThreshold             time.Duration
	Colorful                  bool
	IgnoreRecordNotFoundError bool
	LogLevel                  int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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