Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateColumnNames(targetFile string, models ...interface{}) error
- func IsRecordNotFound(err error) bool
- type BeforeCreateOrUpdate
- type ColumnInfo
- type Cursor
- type Dao
- func (d *Dao) ByID(c context.Context, m Model, id uuid.UUID) error
- func (d *Dao) ByStringID(c context.Context, m Model, strID string) error
- func (d *Dao) Clean() error
- func (d *Dao) Create(c context.Context, m Model) error
- func (d *Dao) CreateOrUpdate(c context.Context, m Model) error
- func (d *Dao) CreateOrUpdateColumns(c context.Context, m Model, ci ...ColumnInfo) error
- func (d *Dao) Delete(c context.Context, m Model) error
- func (d *Dao) DeprecatedUpdateColumn(c context.Context, model Model, col string, val interface{}) error
- func (d *Dao) DeprecatedUpdateColumns(c context.Context, model Model, cols map[string]interface{}) error
- func (d *Dao) GetDeletedByID(c context.Context, m Model, id uuid.UUID) error
- func (d *Dao) HardDelete(c context.Context, m Model) error
- func (d *Dao) IncrColumn(c context.Context, model Model, col string, incr float64) error
- func (d *Dao) Init() error
- func (d *Dao) IsRecordNotFound(err error) bool
- func (d *Dao) Load(c context.Context, m Model) error
- func (d *Dao) Print(v ...interface{})
- func (d *Dao) Query(c context.Context) *Query
- func (d *Dao) UpdateColumns(c context.Context, model Model, ci ...ColumnInfo) error
- type DbStatsCollector
- type DummyDbStatsCollector
- type Logger
- type Model
- type Query
- func (q *Query) All(target interface{}) error
- func (q *Query) Count(sample Model) (int, error)
- func (q *Query) Filter(column, operation string, value interface{}) *Query
- func (q *Query) FilterExpression(expression string, values ...interface{}) *Query
- func (q *Query) First(target Model) error
- func (q *Query) IncludeDeleted() *Query
- func (q *Query) OrderBy(column string, ascDesc ...string) *Query
- func (q *Query) WithDefaultPageSize() *Query
- func (q *Query) WithPageSize(s int) *Query
Constants ¶
View Source
const ( DefaultCursorLimit = 1000 DefaultPageSize = 20 )
Variables ¶
View Source
var Daos = []interface{}{new(Dao)}
Functions ¶
func GenerateColumnNames ¶
func IsRecordNotFound ¶
Types ¶
type BeforeCreateOrUpdate ¶
type BeforeCreateOrUpdate interface {
BeforeCreateOrUpdate() map[string]interface{}
}
type ColumnInfo ¶
type ColumnInfo func() (string, interface{})
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
func NewFirstPageCursor ¶
func NewFirstPageCursor() *Cursor
func (*Cursor) Unserialize ¶
type Dao ¶
type Dao struct { Logger Logger StatsCollector DbStatsCollector Debug bool // contains filtered or unexported fields }
func (*Dao) CreateOrUpdateColumns ¶
func (*Dao) DeprecatedUpdateColumn ¶
func (*Dao) DeprecatedUpdateColumns ¶
func (*Dao) GetDeletedByID ¶
func (*Dao) IncrColumn ¶
func (*Dao) IsRecordNotFound ¶
func (*Dao) Print ¶
func (d *Dao) Print(v ...interface{})
Print is used to log sql statements (implementation of gorm.logger)
func (*Dao) UpdateColumns ¶
type DbStatsCollector ¶
type DummyDbStatsCollector ¶
type DummyDbStatsCollector struct{}
func (DummyDbStatsCollector) AddDbStats ¶
type Logger ¶
type Logger interface { Debugf(c context.Context, format string, args ...interface{}) Infof(c context.Context, format string, args ...interface{}) Warningf(c context.Context, format string, args ...interface{}) Errorf(c context.Context, format string, args ...interface{}) Error(c context.Context, err error, format string, args ...interface{}) Criticalf(c context.Context, format string, args ...interface{}) }
func NewStdoutLogger ¶
func NewStdoutLogger() Logger
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) FilterExpression ¶
func (*Query) IncludeDeleted ¶
func (*Query) WithDefaultPageSize ¶
func (*Query) WithPageSize ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.