Versions in this module Expand all Collapse all v1 v1.10.2 Jun 26, 2023 Changes in this version + const DbPassword + const DbUser + var DialectorSet = wire.NewSet(NewDialectorImpl, wire.Bind(new(Dialector), new(*DialectorImpl))) + var GormSet = wire.NewSet(NewGormImpl, wire.Bind(new(Gorm), new(*GormImpl))) + var QuerySet = wire.NewSet(NewQueryImpl, wire.Bind(new(ormcontract.Query), new(*QueryImpl))) + type Dialector interface + Make func(configs []databasecontract.Config) ([]gorm.Dialector, error) + type DialectorImpl struct + func NewDialectorImpl(config config.Config, connection string) *DialectorImpl + func (d *DialectorImpl) Make(configs []databasecontract.Config) ([]gorm.Dialector, error) + type Event struct + func NewEvent(query *QueryImpl, model, dest any) *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 interface + Make func() (*gormio.DB, error) + type GormImpl struct + func InitializeGorm(config2 config.Config, connection string) *GormImpl + func NewGormImpl(config config.Config, connection string, dbConfig db.Config, ...) *GormImpl + func (r *GormImpl) Make() (*gormio.DB, error) type MysqlDocker + MockConfig *configmock.Config + Port int + func NewMysqlDocker() *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 + MockConfig *configmock.Config + Port int + func NewPostgresqlDocker() *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 struct + func InitializeQuery(ctx context.Context, config2 config.Config, connection string) (*QueryImpl, error) + func NewQueryImpl(ctx context.Context, config config.Config, gorm Gorm) (*QueryImpl, error) + func NewQueryWithWithoutEvents(instance *gormio.DB, withoutEvents bool) *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 + MockConfig *configmock.Config + func NewSqliteDocker(dbName string) *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 + MockConfig *configmock.Config + Port int + func NewSqlserverDocker() *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 struct + func (r Table) Create(driver orm.Driver, db orm.Query) error + func (r Table) CreateWithPrefixAndSingular(driver orm.Driver, db orm.Query) error v1.10.1 Mar 31, 2023 Changes in this version + var ErrorMissingWhereClause = errors.New("WHERE conditions required") + func Configs(connection string) (readConfigs, writeConfigs []contractsdatabase.Config, err error) + func FileWithLineNum() string + func MysqlDocker() (*dockertest.Pool, *dockertest.Resource, orm.Query, error) + func MysqlDsn(connection string, config contractsdatabase.Config) string + func New(connection string) (*gorm.DB, error) + func NewLogger(writer logger.Writer, config logger.Config) logger.Interface + func PostgresqlDocker() (*dockertest.Pool, *dockertest.Resource, orm.Query, error) + func PostgresqlDsn(connection string, config contractsdatabase.Config) string + func SqliteDocker(dbName string) (*dockertest.Pool, *dockertest.Resource, orm.Query, error) + func SqliteDsn(config contractsdatabase.Config) string + func SqlserverDocker() (*dockertest.Pool, *dockertest.Resource, orm.Query, error) + func SqlserverDsn(connection string, config contractsdatabase.Config) string + type Logger struct + func (l *Logger) LogMode(level logger.LogLevel) logger.Interface + 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) 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 Query struct + func NewQuery(ctx context.Context, connection string) (*Query, error) + func NewQueryInstance(instance *gorm.DB) *Query + func (r *Query) Association(association string) contractsorm.Association + func (r *Query) Begin() (contractsorm.Transaction, error) + func (r *Query) Count(count *int64) error + func (r *Query) Create(value any) error + func (r *Query) Delete(value any, conds ...any) (*contractsorm.Result, error) + func (r *Query) Distinct(args ...any) contractsorm.Query + func (r *Query) Driver() contractsorm.Driver + func (r *Query) Exec(sql string, values ...any) (*contractsorm.Result, error) + func (r *Query) Find(dest any, conds ...any) error + func (r *Query) First(dest any) error + func (r *Query) FirstOr(dest any, callback func() error) error + func (r *Query) FirstOrCreate(dest any, conds ...any) error + func (r *Query) FirstOrFail(dest any) error + func (r *Query) FirstOrNew(dest any, attributes any, values ...any) error + func (r *Query) ForceDelete(value any, conds ...any) (*contractsorm.Result, error) + func (r *Query) Get(dest any) error + func (r *Query) Group(name string) contractsorm.Query + func (r *Query) Having(query any, args ...any) contractsorm.Query + func (r *Query) Instance() *gorm.DB + func (r *Query) Join(query string, args ...any) contractsorm.Query + func (r *Query) Limit(limit int) contractsorm.Query + func (r *Query) Load(model any, relation string, args ...any) error + func (r *Query) LoadMissing(model any, relation string, args ...any) error + func (r *Query) Model(value any) contractsorm.Query + func (r *Query) Offset(offset int) contractsorm.Query + func (r *Query) Omit(columns ...string) contractsorm.Query + func (r *Query) OrWhere(query any, args ...any) contractsorm.Query + func (r *Query) Order(value any) contractsorm.Query + func (r *Query) Paginate(page, limit int, dest any, total *int64) error + func (r *Query) Pluck(column string, dest any) error + func (r *Query) Raw(sql string, values ...any) contractsorm.Query + func (r *Query) Save(value any) error + func (r *Query) Scan(dest any) error + func (r *Query) Scopes(funcs ...func(contractsorm.Query) contractsorm.Query) contractsorm.Query + func (r *Query) Select(query any, args ...any) contractsorm.Query + func (r *Query) Table(name string, args ...any) contractsorm.Query + func (r *Query) Update(column string, value any) error + func (r *Query) UpdateOrCreate(dest any, attributes any, values any) error + func (r *Query) Updates(values any) (*contractsorm.Result, error) + func (r *Query) Where(query any, args ...any) contractsorm.Query + func (r *Query) With(query string, args ...any) contractsorm.Query + func (r *Query) WithTrashed() contractsorm.Query + type Transaction struct + func NewTransaction(instance *gorm.DB) *Transaction + func (r *Transaction) Commit() error + func (r *Transaction) Rollback() error