gormx

package
v1.0.0-beta.27 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Expr = gorm.Expr
	Scan = gorm.Scan
)
View Source
var (
	// ErrRecordNotFound record not found error
	ErrRecordNotFound = gorm.ErrRecordNotFound
	// ErrInvalidTransaction invalid transaction when you are trying to `Commit` or `Rollback`
	ErrInvalidTransaction = gorm.ErrInvalidTransaction
	// ErrNotImplemented not implemented
	ErrNotImplemented = gorm.ErrNotImplemented
	// ErrMissingWhereClause missing where clause
	ErrMissingWhereClause = gorm.ErrMissingWhereClause
	// ErrUnsupportedRelation unsupported relations
	ErrUnsupportedRelation = gorm.ErrUnsupportedRelation
	// ErrPrimaryKeyRequired primary keys required
	ErrPrimaryKeyRequired = gorm.ErrPrimaryKeyRequired
	// ErrModelValueRequired model value required
	ErrModelValueRequired = gorm.ErrModelValueRequired
	// ErrInvalidData unsupported data
	ErrInvalidData = gorm.ErrInvalidData
	// ErrUnsupportedDriver unsupported driver
	ErrUnsupportedDriver = gorm.ErrUnsupportedDriver
	// ErrRegistered registered
	ErrRegistered = gorm.ErrRegistered
	// ErrInvalidField invalid field
	ErrInvalidField = gorm.ErrInvalidField
	// ErrEmptySlice empty slice found
	ErrEmptySlice = gorm.ErrEmptySlice
	// ErrDryRunModeUnsupported dry run mode unsupported
	ErrDryRunModeUnsupported = gorm.ErrDryRunModeUnsupported
	// ErrInvalidDB invalid db
	ErrInvalidDB = gorm.ErrInvalidDB
	// ErrInvalidValue invalid value
	ErrInvalidValue = gorm.ErrInvalidValue
	// ErrInvalidValueOfLength invalid values do not match length
	ErrInvalidValueOfLength = gorm.ErrInvalidValueOfLength
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Driver       string        `config:"driver" desc:"SQLDrivers: https://github.com/golang/go/wiki/SQLDrivers"`
	DSN          string        `config:"dsn" desc:"Data Source Name"`
	MaxIdleTime  time.Duration `` /* 175-byte string literal not displayed */
	MaxLifeTime  time.Duration `` /* 171-byte string literal not displayed */
	MaxIdleConns int           `` /* 299-byte string literal not displayed */
	MaxOpenConns int           `` /* 358-byte string literal not displayed */
	// contains filtered or unexported fields
}

Config 配置

func DefaultConfig

func DefaultConfig(key string) *Config

DefaultConfig 默认配置

func StdConfig

func StdConfig(key string, optionFunc ...OptionFunc) *Config

StdConfig 标准配置

func (*Config) Build

func (c *Config) Build() *Gorm

Build 构建实例

func (*Config) Path

func (c *Config) Path() string

Path 实例配置目录

type DB

type DB = gorm.DB

type Gorm

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

func (Gorm) DB

func (orm Gorm) DB() *DB

func (Gorm) Name

func (orm Gorm) Name() string

func (*Gorm) Serve

func (orm *Gorm) Serve(ctx context.Context) error

func (*Gorm) Shutdown

func (orm *Gorm) Shutdown(ctx context.Context) error

type Logger

type Logger struct{}

func (*Logger) Error

func (*Logger) Error(ctx context.Context, tmpl string, args ...interface{})

func (*Logger) Info

func (*Logger) Info(ctx context.Context, tmpl string, args ...interface{})

func (*Logger) LogMode

func (l *Logger) LogMode(gormlog.LogLevel) gormlog.Interface

func (*Logger) Trace

func (*Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

func (*Logger) Warn

func (*Logger) Warn(ctx context.Context, tmpl string, args ...interface{})

type OptionFunc

type OptionFunc func(*Config)

OptionFunc 选项信息

func WithDialector

func WithDialector(dial gorm.Dialector) OptionFunc

Jump to

Keyboard shortcuts

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