Documentation ¶
Index ¶
- Variables
- func FileWithLineNum() string
- func NewLogger(writer logger.Writer, config logger.Config) logger.Interface
- func ToCarbonHookFunc() mapstructure.DecodeHookFunc
- func ToDeletedAtHookFunc() mapstructure.DecodeHookFunc
- func ToTimeHookFunc() mapstructure.DecodeHookFunc
- type Address
- type Author
- type Book
- type Box
- type Conditions
- type CursorImpl
- type Dialector
- type DialectorImpl
- type Event
- func (e *Event) ColumnNames() 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 GormImpl
- type Having
- type House
- type Join
- 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) MockReadWrite(readPort, writePort int)
- func (r *MysqlDocker) New() (orm.Query, error)
- func (r *MysqlDocker) NewWithPrefixAndSingular() (orm.Query, error)
- func (r *MysqlDocker) Query(createTable bool) (orm.Query, error)
- func (r *MysqlDocker) QueryWithPrefixAndSingular() (orm.Query, error)
- type People
- type Person
- type Phone
- type PostgresqlDocker
- func (r *PostgresqlDocker) MockReadWrite(readPort, writePort int)
- func (r *PostgresqlDocker) New() (orm.Query, error)
- func (r *PostgresqlDocker) NewWithPrefixAndSingular() (orm.Query, error)
- func (r *PostgresqlDocker) Query(createTable bool) (orm.Query, error)
- func (r *PostgresqlDocker) QueryWithPrefixAndSingular() (orm.Query, error)
- type Product
- type QueryImpl
- func BuildQueryImpl(ctx context.Context, config config.Config, connection string, gorm gorm.Gorm) (*QueryImpl, error)
- func InitializeQuery(ctx context.Context, config2 config.Config, connection string) (*QueryImpl, error)
- func NewQueryImpl(ctx context.Context, config config.Config, connection string, db *gormio.DB, ...) *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) Cursor() (chan ormcontract.Cursor, 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) Exists(exists *bool) 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) InRandomOrder() 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) OrWhereBetween(column string, x, y any) ormcontract.Query
- func (r *QueryImpl) OrWhereIn(column string, values []any) ormcontract.Query
- func (r *QueryImpl) OrWhereNotBetween(column string, x, y any) ormcontract.Query
- func (r *QueryImpl) OrWhereNotIn(column string, values []any) ormcontract.Query
- func (r *QueryImpl) OrWhereNull(column string) ormcontract.Query
- func (r *QueryImpl) Order(value any) ormcontract.Query
- func (r *QueryImpl) OrderBy(column string, direction ...string) ormcontract.Query
- func (r *QueryImpl) OrderByDesc(column string) 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) SetContext(ctx context.Context)
- func (r *QueryImpl) SharedLock() ormcontract.Query
- func (r *QueryImpl) Sum(column string, dest any) error
- func (r *QueryImpl) Table(name string, args ...any) ormcontract.Query
- func (r *QueryImpl) ToRawSql() ormcontract.ToSql
- func (r *QueryImpl) ToSql() ormcontract.ToSql
- 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) WhereBetween(column string, x, y any) ormcontract.Query
- func (r *QueryImpl) WhereIn(column string, values []any) ormcontract.Query
- func (r *QueryImpl) WhereNotBetween(column string, x, y any) ormcontract.Query
- func (r *QueryImpl) WhereNotIn(column string, values []any) ormcontract.Query
- func (r *QueryImpl) WhereNotNull(column string) ormcontract.Query
- func (r *QueryImpl) WhereNull(column string) 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 Review
- type Role
- type Select
- type SqliteDocker
- func (r *SqliteDocker) MockReadWrite(readDatabase string)
- func (r *SqliteDocker) New() (orm.Query, error)
- func (r *SqliteDocker) NewWithPrefixAndSingular() (orm.Query, error)
- func (r *SqliteDocker) Query(createTable bool) (orm.Query, error)
- func (r *SqliteDocker) QueryWithPrefixAndSingular() (orm.Query, error)
- type SqlserverDocker
- func (r *SqlserverDocker) MockReadWrite(readPort, writePort int)
- func (r *SqlserverDocker) New() (orm.Query, error)
- func (r *SqlserverDocker) NewWithPrefixAndSingular() (orm.Query, error)
- func (r *SqlserverDocker) Query(createTable bool) (orm.Query, error)
- func (r *SqlserverDocker) QueryWithPrefixAndSingular() (orm.Query, error)
- type Table
- type Tables
- type ToSql
- func (r *ToSql) Count() string
- func (r *ToSql) Create(value any) string
- func (r *ToSql) Delete(value any, conds ...any) string
- func (r *ToSql) Find(dest any, conds ...any) string
- func (r *ToSql) First(dest any) string
- func (r *ToSql) Get(dest any) string
- func (r *ToSql) Pluck(column string, dest any) string
- func (r *ToSql) Save(value any) string
- func (r *ToSql) Sum(column string, dest any) string
- func (r *ToSql) Update(column any, value ...any) string
- type Transaction
- type User
- type Where
- type With
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 QuerySet = wire.NewSet(BuildQueryImpl, 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
func ToCarbonHookFunc ¶
func ToCarbonHookFunc() mapstructure.DecodeHookFunc
func ToDeletedAtHookFunc ¶
func ToDeletedAtHookFunc() mapstructure.DecodeHookFunc
func ToTimeHookFunc ¶
func ToTimeHookFunc() mapstructure.DecodeHookFunc
Types ¶
type Conditions ¶
type Conditions struct {
// contains filtered or unexported fields
}
type CursorImpl ¶
type CursorImpl struct {
// contains filtered or unexported fields
}
func (*CursorImpl) Scan ¶
func (c *CursorImpl) Scan(value any) error
type Dialector ¶
type Dialector interface {
Make(configs []databasecontract.Config) ([]gorm.Dialector, error)
}
type DialectorImpl ¶
type DialectorImpl struct {
// contains filtered or unexported fields
}
func NewDialectorImpl ¶
func NewDialectorImpl(config config.Config, connection string) *DialectorImpl
func (*DialectorImpl) Make ¶
func (d *DialectorImpl) Make(configs []databasecontract.Config) ([]gorm.Dialector, error)
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func (*Event) ColumnNames ¶
func (*Event) GetAttribute ¶
func (*Event) ModelOfMap ¶
func (*Event) SetAttribute ¶
type GormImpl ¶
type GormImpl struct {
// contains filtered or unexported fields
}
func NewGormImpl ¶
type Logger ¶
type MysqlDocker ¶
type MysqlDocker struct { MockConfig *mocksconfig.Config Port int // contains filtered or unexported fields }
func NewMysqlDocker ¶
func NewMysqlDocker(driver testing.DatabaseDriver) *MysqlDocker
func (*MysqlDocker) MockReadWrite ¶
func (r *MysqlDocker) MockReadWrite(readPort, writePort int)
func (*MysqlDocker) NewWithPrefixAndSingular ¶
func (r *MysqlDocker) NewWithPrefixAndSingular() (orm.Query, error)
func (*MysqlDocker) QueryWithPrefixAndSingular ¶
func (r *MysqlDocker) QueryWithPrefixAndSingular() (orm.Query, error)
type People ¶
type People struct { orm.Model orm.SoftDeletes Body string }
func (*People) Connection ¶
type Person ¶
type Person struct { orm.Model orm.SoftDeletes Name string }
func (*Person) Connection ¶
type PostgresqlDocker ¶
type PostgresqlDocker struct { MockConfig *mocksconfig.Config Port int // contains filtered or unexported fields }
func NewPostgresDocker ¶
func NewPostgresDocker(driver testing.DatabaseDriver) *PostgresqlDocker
func (*PostgresqlDocker) MockReadWrite ¶
func (r *PostgresqlDocker) MockReadWrite(readPort, writePort int)
func (*PostgresqlDocker) NewWithPrefixAndSingular ¶
func (r *PostgresqlDocker) NewWithPrefixAndSingular() (orm.Query, error)
func (*PostgresqlDocker) Query ¶
func (r *PostgresqlDocker) Query(createTable bool) (orm.Query, error)
func (*PostgresqlDocker) QueryWithPrefixAndSingular ¶
func (r *PostgresqlDocker) QueryWithPrefixAndSingular() (orm.Query, error)
type Product ¶
type Product struct { orm.Model orm.SoftDeletes Name string }
func (*Product) Connection ¶
type QueryImpl ¶
type QueryImpl struct {
// contains filtered or unexported fields
}
func BuildQueryImpl ¶
func InitializeQuery ¶
func NewQueryImpl ¶
func (*QueryImpl) Association ¶
func (r *QueryImpl) Association(association string) ormcontract.Association
func (*QueryImpl) Begin ¶
func (r *QueryImpl) Begin() (ormcontract.Transaction, error)
func (*QueryImpl) Driver ¶
func (r *QueryImpl) Driver() ormcontract.Driver
func (*QueryImpl) FirstOrFail ¶
func (*QueryImpl) FirstOrNew ¶
func (*QueryImpl) ForceDelete ¶
func (*QueryImpl) InRandomOrder ¶
func (r *QueryImpl) InRandomOrder() ormcontract.Query
func (*QueryImpl) LoadMissing ¶
func (*QueryImpl) LockForUpdate ¶
func (r *QueryImpl) LockForUpdate() ormcontract.Query
func (*QueryImpl) OrWhereBetween ¶
func (r *QueryImpl) OrWhereBetween(column string, x, y any) ormcontract.Query
func (*QueryImpl) OrWhereIn ¶
func (r *QueryImpl) OrWhereIn(column string, values []any) ormcontract.Query
func (*QueryImpl) OrWhereNotBetween ¶
func (r *QueryImpl) OrWhereNotBetween(column string, x, y any) ormcontract.Query
func (*QueryImpl) OrWhereNotIn ¶
func (r *QueryImpl) OrWhereNotIn(column string, values []any) ormcontract.Query
func (*QueryImpl) OrWhereNull ¶
func (r *QueryImpl) OrWhereNull(column string) ormcontract.Query
func (*QueryImpl) OrderBy ¶
func (r *QueryImpl) OrderBy(column string, direction ...string) ormcontract.Query
func (*QueryImpl) OrderByDesc ¶
func (r *QueryImpl) OrderByDesc(column string) ormcontract.Query
func (*QueryImpl) SaveQuietly ¶
func (*QueryImpl) Scopes ¶
func (r *QueryImpl) Scopes(funcs ...func(ormcontract.Query) ormcontract.Query) ormcontract.Query
func (*QueryImpl) SetContext ¶
func (*QueryImpl) SharedLock ¶
func (r *QueryImpl) SharedLock() ormcontract.Query
func (*QueryImpl) ToRawSql ¶
func (r *QueryImpl) ToRawSql() ormcontract.ToSql
func (*QueryImpl) ToSql ¶
func (r *QueryImpl) ToSql() ormcontract.ToSql
func (*QueryImpl) UpdateOrCreate ¶
func (*QueryImpl) WhereBetween ¶
func (r *QueryImpl) WhereBetween(column string, x, y any) ormcontract.Query
func (*QueryImpl) WhereIn ¶
func (r *QueryImpl) WhereIn(column string, values []any) ormcontract.Query
func (*QueryImpl) WhereNotBetween ¶
func (r *QueryImpl) WhereNotBetween(column string, x, y any) ormcontract.Query
func (*QueryImpl) WhereNotIn ¶
func (r *QueryImpl) WhereNotIn(column string, values []any) ormcontract.Query
func (*QueryImpl) WhereNotNull ¶
func (r *QueryImpl) WhereNotNull(column string) ormcontract.Query
func (*QueryImpl) WithTrashed ¶
func (r *QueryImpl) WithTrashed() ormcontract.Query
func (*QueryImpl) WithoutEvents ¶
func (r *QueryImpl) WithoutEvents() ormcontract.Query
type Review ¶
type Review struct { orm.Model orm.SoftDeletes Body string }
func (*Review) Connection ¶
type SqliteDocker ¶
type SqliteDocker struct { MockConfig *mocksconfig.Config // contains filtered or unexported fields }
func NewSqliteDocker ¶
func NewSqliteDocker(driver testing.DatabaseDriver) *SqliteDocker
func (*SqliteDocker) MockReadWrite ¶
func (r *SqliteDocker) MockReadWrite(readDatabase string)
func (*SqliteDocker) NewWithPrefixAndSingular ¶
func (r *SqliteDocker) NewWithPrefixAndSingular() (orm.Query, error)
func (*SqliteDocker) QueryWithPrefixAndSingular ¶
func (r *SqliteDocker) QueryWithPrefixAndSingular() (orm.Query, error)
type SqlserverDocker ¶
type SqlserverDocker struct { MockConfig *mocksconfig.Config Port int // contains filtered or unexported fields }
func NewSqlserverDocker ¶
func NewSqlserverDocker(driver testing.DatabaseDriver) *SqlserverDocker
func (*SqlserverDocker) MockReadWrite ¶
func (r *SqlserverDocker) MockReadWrite(readPort, writePort int)
func (*SqlserverDocker) NewWithPrefixAndSingular ¶
func (r *SqlserverDocker) NewWithPrefixAndSingular() (orm.Query, error)
func (*SqlserverDocker) Query ¶
func (r *SqlserverDocker) Query(createTable bool) (orm.Query, error)
func (*SqlserverDocker) QueryWithPrefixAndSingular ¶
func (r *SqlserverDocker) QueryWithPrefixAndSingular() (orm.Query, error)
type Transaction ¶
func NewTransaction ¶
func (*Transaction) Commit ¶
func (r *Transaction) Commit() error
func (*Transaction) Rollback ¶
func (r *Transaction) Rollback() error
type User ¶
type User struct { orm.Model orm.SoftDeletes Name string Bio *string Avatar string Address *Address Books []*Book House *House `gorm:"polymorphic:Houseable"` Phones []*Phone `gorm:"polymorphic:Phoneable"` Roles []*Role `gorm:"many2many:role_user"` // contains filtered or unexported fields }
func (*User) DispatchesEvents ¶
func (u *User) DispatchesEvents() map[ormcontract.EventType]func(ormcontract.Event) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.