database

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 26 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileWithLineNum added in v1.0.0

func FileWithLineNum() string

FileWithLineNum return the file name and line number of the current file

func GetDsn added in v1.0.0

func GetDsn(connection string) (string, error)

func New added in v1.0.0

func New(writer logger.Writer, config logger.Config) logger.Interface

New initialize Logger

func NewGormDB added in v1.0.1

func NewGormDB(ctx context.Context, connection string) (contractsorm.DB, error)

func NewGormInstance added in v1.0.0

func NewGormInstance(connection string) (*gorm.DB, error)

func NewGormQuery added in v1.0.1

func NewGormQuery(instance *gorm.DB) contractsorm.Query

func NewGormTransaction added in v1.0.1

func NewGormTransaction(instance *gorm.DB) contractsorm.Transaction

func NewOrm added in v1.0.0

func NewOrm() contractsorm.Orm

Types

type Application

type Application struct {
}

func (*Application) Init

func (app *Application) Init() orm.Orm

type DB added in v1.0.0

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

func (*DB) Connection added in v1.0.0

func (r *DB) Connection(name string) database.DB

func (*DB) Query added in v1.0.0

func (r *DB) Query() database.Sqlx

func (*DB) Transaction added in v1.0.0

func (r *DB) Transaction(ctx context.Context, txFunc func(tx *sqlx.Tx) error) error

type GormDB added in v1.0.1

type GormDB struct {
	contractsorm.Query
	// contains filtered or unexported fields
}

func (*GormDB) Begin added in v1.0.1

func (r *GormDB) Begin() (contractsorm.Transaction, error)

type GormQuery added in v1.0.1

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

func (*GormQuery) Count added in v1.0.1

func (r *GormQuery) Count(count *int64) error

func (*GormQuery) Create added in v1.0.1

func (r *GormQuery) Create(value interface{}) error

func (*GormQuery) Delete added in v1.0.1

func (r *GormQuery) Delete(value interface{}, conds ...interface{}) error

func (*GormQuery) Distinct added in v1.0.2

func (r *GormQuery) Distinct(args ...interface{}) contractsorm.Query

func (*GormQuery) Exec added in v1.0.1

func (r *GormQuery) Exec(sql string, values ...interface{}) error

func (*GormQuery) Find added in v1.0.1

func (r *GormQuery) Find(dest interface{}, conds ...interface{}) error

func (*GormQuery) First added in v1.0.1

func (r *GormQuery) First(dest interface{}) error

func (*GormQuery) FirstOrCreate added in v1.0.1

func (r *GormQuery) FirstOrCreate(dest interface{}, conds ...interface{}) error

func (*GormQuery) ForceDelete added in v1.0.1

func (r *GormQuery) ForceDelete(value interface{}, conds ...interface{}) error

func (*GormQuery) Get added in v1.0.1

func (r *GormQuery) Get(dest interface{}) error

func (*GormQuery) Group added in v1.0.1

func (r *GormQuery) Group(name string) contractsorm.Query

func (*GormQuery) Having added in v1.0.1

func (r *GormQuery) Having(query interface{}, args ...interface{}) contractsorm.Query

func (*GormQuery) Join added in v1.0.1

func (r *GormQuery) Join(query string, args ...interface{}) contractsorm.Query

func (*GormQuery) Limit added in v1.0.1

func (r *GormQuery) Limit(limit int) contractsorm.Query

func (*GormQuery) Model added in v1.0.1

func (r *GormQuery) Model(value interface{}) contractsorm.Query

func (*GormQuery) Offset added in v1.0.1

func (r *GormQuery) Offset(offset int) contractsorm.Query

func (*GormQuery) OrWhere added in v1.0.1

func (r *GormQuery) OrWhere(query interface{}, args ...interface{}) contractsorm.Query

func (*GormQuery) Order added in v1.0.1

func (r *GormQuery) Order(value interface{}) contractsorm.Query

func (*GormQuery) Pluck added in v1.0.1

func (r *GormQuery) Pluck(column string, dest interface{}) error

func (*GormQuery) Raw added in v1.0.1

func (r *GormQuery) Raw(sql string, values ...interface{}) contractsorm.Query

func (*GormQuery) Save added in v1.0.1

func (r *GormQuery) Save(value interface{}) error

func (*GormQuery) Scan added in v1.0.1

func (r *GormQuery) Scan(dest interface{}) error

func (*GormQuery) Scopes added in v1.0.1

func (r *GormQuery) Scopes(funcs ...func(contractsorm.Query) contractsorm.Query) contractsorm.Query

func (*GormQuery) Select added in v1.0.1

func (r *GormQuery) Select(query interface{}, args ...interface{}) contractsorm.Query

func (*GormQuery) Table added in v1.0.1

func (r *GormQuery) Table(name string, args ...interface{}) contractsorm.Query

func (*GormQuery) Update added in v1.0.1

func (r *GormQuery) Update(column string, value interface{}) error

func (*GormQuery) Updates added in v1.0.1

func (r *GormQuery) Updates(values interface{}) error

func (*GormQuery) Where added in v1.0.1

func (r *GormQuery) Where(query interface{}, args ...interface{}) contractsorm.Query

func (*GormQuery) WithTrashed added in v1.0.1

func (r *GormQuery) WithTrashed() contractsorm.Query

type GormTransaction added in v1.0.1

type GormTransaction struct {
	contractsorm.Query
	// contains filtered or unexported fields
}

func (*GormTransaction) Commit added in v1.0.1

func (r *GormTransaction) Commit() error

func (*GormTransaction) Rollback added in v1.0.1

func (r *GormTransaction) Rollback() error

type Logger added in v1.0.0

type Logger struct {
	logger.Writer
	logger.Config
	// contains filtered or unexported fields
}

func (Logger) Error added in v1.0.0

func (l Logger) Error(ctx context.Context, msg string, data ...interface{})

Error print error messages

func (Logger) Info added in v1.0.0

func (l Logger) Info(ctx context.Context, msg string, data ...interface{})

Info print info

func (*Logger) LogMode added in v1.0.0

func (l *Logger) LogMode(level logger.LogLevel) logger.Interface

LogMode log mode

func (Logger) Trace added in v1.0.0

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

Trace print sql message

func (Logger) Warn added in v1.0.0

func (l Logger) Warn(ctx context.Context, msg string, data ...interface{})

Warn print warn messages

type Orm added in v1.0.0

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

func (*Orm) Connection added in v1.0.0

func (r *Orm) Connection(name string) contractsorm.Orm

func (*Orm) Query added in v1.0.0

func (r *Orm) Query() contractsorm.DB

func (*Orm) Transaction added in v1.0.0

func (r *Orm) Transaction(txFunc func(tx contractsorm.Transaction) error) error

func (*Orm) WithContext added in v1.0.0

func (r *Orm) WithContext(ctx context.Context) contractsorm.Orm

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (database *ServiceProvider) Boot()

func (*ServiceProvider) Register

func (database *ServiceProvider) Register()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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