Documentation ¶
Index ¶
- Variables
- func FileWithLineNum() string
- func New(connection string) (*gormio.DB, error)
- func NewLogger(writer logger.Writer, config logger.Config) logger.Interface
- type Dialector
- type DialectorImpl
- type Event
- func (e *Event) ColumnNamesWithDbColumnNames() map[string]string
- func (e *Event) Context() context.Context
- func (e *Event) DestOfMap() map[string]any
- func (e *Event) GetAttribute(key string) any
- func (e *Event) GetOriginal(key string, def ...any) any
- func (e *Event) IsClean(fields ...string) bool
- func (e *Event) IsDirty(columns ...string) bool
- func (e *Event) ModelOfMap() map[string]any
- func (e *Event) Query() orm.Query
- func (e *Event) SetAttribute(key string, value any)
- type Gorm
- type GormImpl
- type Logger
- func (l Logger) Error(ctx context.Context, msg string, data ...any)
- func (l Logger) Info(ctx context.Context, msg string, data ...any)
- func (l *Logger) LogMode(level logger.LogLevel) logger.Interface
- func (l Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l Logger) Warn(ctx context.Context, msg string, data ...any)
- type MysqlDocker
- func (r *MysqlDocker) Init() (*dockertest.Pool, *dockertest.Resource, error)
- func (r *MysqlDocker) MockReadWrite(readPort, writePort int)
- func (r *MysqlDocker) New() (*dockertest.Pool, *dockertest.Resource, orm.Query, error)
- func (r *MysqlDocker) Query(createTable bool) (orm.Query, error)
- func (r *MysqlDocker) QueryWithPrefixAndSingular() (orm.Query, error)
- type PostgresqlDocker
- func (r *PostgresqlDocker) Init() (*dockertest.Pool, *dockertest.Resource, error)
- func (r *PostgresqlDocker) MockReadWrite(readPort, writePort int)
- func (r *PostgresqlDocker) New() (*dockertest.Pool, *dockertest.Resource, orm.Query, error)
- func (r *PostgresqlDocker) Query(createTable bool) (orm.Query, error)
- func (r *PostgresqlDocker) QueryWithPrefixAndSingular() (orm.Query, error)
- type QueryImpl
- func (r *QueryImpl) Association(association string) ormcontract.Association
- func (r *QueryImpl) Begin() (ormcontract.Transaction, error)
- func (r *QueryImpl) Count(count *int64) error
- func (r *QueryImpl) Create(value any) error
- func (r *QueryImpl) Delete(dest any, conds ...any) (*ormcontract.Result, error)
- func (r *QueryImpl) Distinct(args ...any) ormcontract.Query
- func (r *QueryImpl) Driver() ormcontract.Driver
- func (r *QueryImpl) Exec(sql string, values ...any) (*ormcontract.Result, error)
- func (r *QueryImpl) Find(dest any, conds ...any) error
- func (r *QueryImpl) FindOrFail(dest any, conds ...any) error
- func (r *QueryImpl) First(dest any) error
- func (r *QueryImpl) FirstOr(dest any, callback func() error) error
- func (r *QueryImpl) FirstOrCreate(dest any, conds ...any) error
- func (r *QueryImpl) FirstOrFail(dest any) error
- func (r *QueryImpl) FirstOrNew(dest any, attributes any, values ...any) error
- func (r *QueryImpl) ForceDelete(value any, conds ...any) (*ormcontract.Result, error)
- func (r *QueryImpl) Get(dest any) error
- func (r *QueryImpl) Group(name string) ormcontract.Query
- func (r *QueryImpl) Having(query any, args ...any) ormcontract.Query
- func (r *QueryImpl) Instance() *gormio.DB
- func (r *QueryImpl) Join(query string, args ...any) ormcontract.Query
- func (r *QueryImpl) Limit(limit int) ormcontract.Query
- func (r *QueryImpl) Load(model any, relation string, args ...any) error
- func (r *QueryImpl) LoadMissing(model any, relation string, args ...any) error
- func (r *QueryImpl) LockForUpdate() ormcontract.Query
- func (r *QueryImpl) Model(value any) ormcontract.Query
- func (r *QueryImpl) Offset(offset int) ormcontract.Query
- func (r *QueryImpl) Omit(columns ...string) ormcontract.Query
- func (r *QueryImpl) OrWhere(query any, args ...any) ormcontract.Query
- func (r *QueryImpl) Order(value any) ormcontract.Query
- func (r *QueryImpl) Paginate(page, limit int, dest any, total *int64) error
- func (r *QueryImpl) Pluck(column string, dest any) error
- func (r *QueryImpl) Raw(sql string, values ...any) ormcontract.Query
- func (r *QueryImpl) Save(value any) error
- func (r *QueryImpl) SaveQuietly(value any) error
- func (r *QueryImpl) Scan(dest any) error
- func (r *QueryImpl) Scopes(funcs ...func(ormcontract.Query) ormcontract.Query) ormcontract.Query
- func (r *QueryImpl) Select(query any, args ...any) ormcontract.Query
- func (r *QueryImpl) SharedLock() ormcontract.Query
- func (r *QueryImpl) Table(name string, args ...any) ormcontract.Query
- func (r *QueryImpl) Update(column any, value ...any) (*ormcontract.Result, error)
- func (r *QueryImpl) UpdateOrCreate(dest any, attributes any, values any) error
- func (r *QueryImpl) Where(query any, args ...any) ormcontract.Query
- func (r *QueryImpl) With(query string, args ...any) ormcontract.Query
- func (r *QueryImpl) WithTrashed() ormcontract.Query
- func (r *QueryImpl) WithoutEvents() ormcontract.Query
- type SqliteDocker
- func (r *SqliteDocker) Init() (*dockertest.Pool, *dockertest.Resource, error)
- func (r *SqliteDocker) MockReadWrite()
- func (r *SqliteDocker) New() (*dockertest.Pool, *dockertest.Resource, orm.Query, error)
- func (r *SqliteDocker) Query(createTable bool) (orm.Query, error)
- func (r *SqliteDocker) QueryWithPrefixAndSingular() (orm.Query, error)
- type SqlserverDocker
- func (r *SqlserverDocker) Init() (*dockertest.Pool, *dockertest.Resource, error)
- func (r *SqlserverDocker) MockReadWrite(readPort, writePort int)
- func (r *SqlserverDocker) New() (*dockertest.Pool, *dockertest.Resource, orm.Query, error)
- func (r *SqlserverDocker) Query(createTable bool) (orm.Query, error)
- func (r *SqlserverDocker) QueryWithPrefixAndSingular() (orm.Query, error)
- type Table
- type Transaction
Constants ¶
This section is empty.
Variables ¶
View Source
var DialectorSet = wire.NewSet(NewDialectorImpl, wire.Bind(new(Dialector), new(*DialectorImpl)))
View Source
var (
ErrorMissingWhereClause = errors.New("WHERE conditions required")
)
View Source
var GormSet = wire.NewSet(NewGormImpl, wire.Bind(new(Gorm), new(*GormImpl)))
View Source
var QuerySet = wire.NewSet(NewQueryImpl, wire.Bind(new(ormcontract.Query), new(*QueryImpl)))
Functions ¶
func FileWithLineNum ¶
func FileWithLineNum() string
FileWithLineNum return the file name and line number of the current file
Types ¶
type Dialector ¶ added in v1.12.0
type Dialector interface {
Make(configs []databasecontract.Config) ([]gorm.Dialector, error)
}
type DialectorImpl ¶ added in v1.12.0
type DialectorImpl struct {
// contains filtered or unexported fields
}
func NewDialectorImpl ¶ added in v1.12.0
func NewDialectorImpl(config config.Config, connection string) *DialectorImpl
func (*DialectorImpl) Make ¶ added in v1.12.0
func (d *DialectorImpl) Make(configs []databasecontract.Config) ([]gorm.Dialector, error)
type Event ¶ added in v1.11.0
type Event struct {
// contains filtered or unexported fields
}
func (*Event) ColumnNamesWithDbColumnNames ¶ added in v1.11.0
func (*Event) GetAttribute ¶ added in v1.11.0
func (*Event) GetOriginal ¶ added in v1.11.0
func (*Event) ModelOfMap ¶ added in v1.11.0
func (*Event) SetAttribute ¶ added in v1.11.0
type GormImpl ¶ added in v1.12.0
type GormImpl struct {
// contains filtered or unexported fields
}
func InitializeGorm ¶ added in v1.12.0
func NewGormImpl ¶ added in v1.12.0
type Logger ¶
type MysqlDocker ¶
type MysqlDocker struct { MockConfig *configmock.Config Port int // contains filtered or unexported fields }
func NewMysqlDocker ¶ added in v1.12.0
func NewMysqlDocker() *MysqlDocker
func (*MysqlDocker) Init ¶ added in v1.12.0
func (r *MysqlDocker) Init() (*dockertest.Pool, *dockertest.Resource, error)
func (*MysqlDocker) MockReadWrite ¶ added in v1.12.0
func (r *MysqlDocker) MockReadWrite(readPort, writePort int)
func (*MysqlDocker) New ¶ added in v1.12.0
func (r *MysqlDocker) New() (*dockertest.Pool, *dockertest.Resource, orm.Query, error)
func (*MysqlDocker) Query ¶ added in v1.12.0
func (r *MysqlDocker) Query(createTable bool) (orm.Query, error)
func (*MysqlDocker) QueryWithPrefixAndSingular ¶ added in v1.12.0
func (r *MysqlDocker) QueryWithPrefixAndSingular() (orm.Query, error)
type PostgresqlDocker ¶
type PostgresqlDocker struct { MockConfig *configmock.Config Port int // contains filtered or unexported fields }
func NewPostgresqlDocker ¶ added in v1.12.0
func NewPostgresqlDocker() *PostgresqlDocker
func (*PostgresqlDocker) Init ¶ added in v1.12.0
func (r *PostgresqlDocker) Init() (*dockertest.Pool, *dockertest.Resource, error)
func (*PostgresqlDocker) MockReadWrite ¶ added in v1.12.0
func (r *PostgresqlDocker) MockReadWrite(readPort, writePort int)
func (*PostgresqlDocker) New ¶ added in v1.12.0
func (r *PostgresqlDocker) New() (*dockertest.Pool, *dockertest.Resource, orm.Query, error)
func (*PostgresqlDocker) Query ¶ added in v1.12.0
func (r *PostgresqlDocker) Query(createTable bool) (orm.Query, error)
func (*PostgresqlDocker) QueryWithPrefixAndSingular ¶ added in v1.12.0
func (r *PostgresqlDocker) QueryWithPrefixAndSingular() (orm.Query, error)
type QueryImpl ¶ added in v1.12.0
type QueryImpl struct {
// contains filtered or unexported fields
}
func InitializeQuery ¶ added in v1.12.0
func NewQueryImpl ¶ added in v1.12.0
func NewQueryWithWithoutEvents ¶ added in v1.11.0
func (*QueryImpl) Association ¶ added in v1.12.0
func (r *QueryImpl) Association(association string) ormcontract.Association
func (*QueryImpl) Begin ¶ added in v1.12.0
func (r *QueryImpl) Begin() (ormcontract.Transaction, error)
func (*QueryImpl) Distinct ¶ added in v1.12.0
func (r *QueryImpl) Distinct(args ...any) ormcontract.Query
func (*QueryImpl) Driver ¶ added in v1.12.0
func (r *QueryImpl) Driver() ormcontract.Driver
func (*QueryImpl) FindOrFail ¶ added in v1.12.0
func (*QueryImpl) FirstOrCreate ¶ added in v1.12.0
func (*QueryImpl) FirstOrFail ¶ added in v1.12.0
func (*QueryImpl) FirstOrNew ¶ added in v1.12.0
func (*QueryImpl) ForceDelete ¶ added in v1.12.0
func (*QueryImpl) Having ¶ added in v1.12.0
func (r *QueryImpl) Having(query any, args ...any) ormcontract.Query
func (*QueryImpl) Join ¶ added in v1.12.0
func (r *QueryImpl) Join(query string, args ...any) ormcontract.Query
func (*QueryImpl) LoadMissing ¶ added in v1.12.0
func (*QueryImpl) LockForUpdate ¶ added in v1.12.0
func (r *QueryImpl) LockForUpdate() ormcontract.Query
func (*QueryImpl) Offset ¶ added in v1.12.0
func (r *QueryImpl) Offset(offset int) ormcontract.Query
func (*QueryImpl) Omit ¶ added in v1.12.0
func (r *QueryImpl) Omit(columns ...string) ormcontract.Query
func (*QueryImpl) OrWhere ¶ added in v1.12.0
func (r *QueryImpl) OrWhere(query any, args ...any) ormcontract.Query
func (*QueryImpl) Raw ¶ added in v1.12.0
func (r *QueryImpl) Raw(sql string, values ...any) ormcontract.Query
func (*QueryImpl) SaveQuietly ¶ added in v1.12.0
func (*QueryImpl) Scopes ¶ added in v1.12.0
func (r *QueryImpl) Scopes(funcs ...func(ormcontract.Query) ormcontract.Query) ormcontract.Query
func (*QueryImpl) Select ¶ added in v1.12.0
func (r *QueryImpl) Select(query any, args ...any) ormcontract.Query
func (*QueryImpl) SharedLock ¶ added in v1.12.0
func (r *QueryImpl) SharedLock() ormcontract.Query
func (*QueryImpl) Table ¶ added in v1.12.0
func (r *QueryImpl) Table(name string, args ...any) ormcontract.Query
func (*QueryImpl) UpdateOrCreate ¶ added in v1.12.0
func (*QueryImpl) Where ¶ added in v1.12.0
func (r *QueryImpl) Where(query any, args ...any) ormcontract.Query
func (*QueryImpl) With ¶ added in v1.12.0
func (r *QueryImpl) With(query string, args ...any) ormcontract.Query
func (*QueryImpl) WithTrashed ¶ added in v1.12.0
func (r *QueryImpl) WithTrashed() ormcontract.Query
func (*QueryImpl) WithoutEvents ¶ added in v1.12.0
func (r *QueryImpl) WithoutEvents() ormcontract.Query
type SqliteDocker ¶
type SqliteDocker struct { MockConfig *configmock.Config // contains filtered or unexported fields }
func NewSqliteDocker ¶ added in v1.12.0
func NewSqliteDocker(dbName string) *SqliteDocker
func (*SqliteDocker) Init ¶ added in v1.12.0
func (r *SqliteDocker) Init() (*dockertest.Pool, *dockertest.Resource, error)
func (*SqliteDocker) MockReadWrite ¶ added in v1.12.0
func (r *SqliteDocker) MockReadWrite()
func (*SqliteDocker) New ¶ added in v1.12.0
func (r *SqliteDocker) New() (*dockertest.Pool, *dockertest.Resource, orm.Query, error)
func (*SqliteDocker) Query ¶ added in v1.12.0
func (r *SqliteDocker) Query(createTable bool) (orm.Query, error)
func (*SqliteDocker) QueryWithPrefixAndSingular ¶ added in v1.12.0
func (r *SqliteDocker) QueryWithPrefixAndSingular() (orm.Query, error)
type SqlserverDocker ¶
type SqlserverDocker struct { MockConfig *configmock.Config Port int // contains filtered or unexported fields }
func NewSqlserverDocker ¶ added in v1.12.0
func NewSqlserverDocker() *SqlserverDocker
func (*SqlserverDocker) Init ¶ added in v1.12.0
func (r *SqlserverDocker) Init() (*dockertest.Pool, *dockertest.Resource, error)
func (*SqlserverDocker) MockReadWrite ¶ added in v1.12.0
func (r *SqlserverDocker) MockReadWrite(readPort, writePort int)
func (*SqlserverDocker) New ¶ added in v1.12.0
func (r *SqlserverDocker) New() (*dockertest.Pool, *dockertest.Resource, orm.Query, error)
func (*SqlserverDocker) Query ¶ added in v1.12.0
func (r *SqlserverDocker) Query(createTable bool) (orm.Query, error)
func (*SqlserverDocker) QueryWithPrefixAndSingular ¶ added in v1.12.0
func (r *SqlserverDocker) QueryWithPrefixAndSingular() (orm.Query, error)
type Transaction ¶
func NewTransaction ¶
func NewTransaction(tx *gorm.DB) *Transaction
func (*Transaction) Commit ¶
func (r *Transaction) Commit() error
func (*Transaction) Rollback ¶
func (r *Transaction) Rollback() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.