Documentation ¶
Index ¶
- Variables
- func Bool(b bool) *bool
- func BoolCover(b *bool) bool
- func Float(f float64) *float64
- func FormatDsn(m map[string]string) string
- func Int(i int) *int
- func Int32(i int32) *int32
- func Int64(i int64) *int64
- func ParseDsn(s string) (map[string]string, error)
- func String(s string) *string
- func StringCover(s *string) string
- func Time(t time.Time) *time.Time
- func TimeCover(t *time.Time) time.Time
- func ToPostgreType(t reflect.Type, dbTag string, length, limit int) (string, error)
- func ToTableName(s string) string
- func Uint(i uint) *uint
- func Uint32(i uint32) *uint32
- func Uint64(i uint64) *uint64
- type BaseModel
- func (b *BaseModel[T]) Clear() error
- func (b *BaseModel[T]) CountWhere(where string, args ...any) (int64, error)
- func (b *BaseModel[T]) Delete(id any) (int64, error)
- func (b *BaseModel[T]) DeleteWhere(where string, args ...any) (int64, error)
- func (b *BaseModel[T]) Exists(id any) (bool, error)
- func (b *BaseModel[T]) ExistsWhere(where string, args ...any) (bool, error)
- func (b *BaseModel[T]) Find(id any) (*T, error)
- func (b *BaseModel[T]) FindAndUpdateSet(where, sets string, args ...any) (*T, error)
- func (b *BaseModel[T]) FindWhere(where string, args ...any) (*T, error)
- func (b *BaseModel[T]) GetCreateTableSQL(primaryKeyModel *indexModel) string
- func (b *BaseModel[T]) GetIndexes() ([]IndexSchema, error)
- func (b *BaseModel[T]) GetInsertReturningSQL() ([]int, string)
- func (b *BaseModel[T]) GetInsertSQL() ([]int, string)
- func (b *BaseModel[T]) GetSelectFields() ([]int, string)
- func (b *BaseModel[T]) GetSelectSQL() ([]int, string)
- func (b *BaseModel[T]) Insert(v T) (any, error)
- func (b *BaseModel[T]) Query(queryTrail string, args ...any) ([]T, error)
- func (b *BaseModel[T]) QueryAndUpdateSet(where, sets string, args ...any) ([]T, error)
- func (b *BaseModel[T]) QueryWhere(where string, args ...any) ([]T, error)
- func (b *BaseModel[T]) Truncate() error
- func (b *BaseModel[T]) UpdateSet(where, sets string, args ...any) (int64, error)
- type Column
- type IndexSchema
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AutoSyncTableSchema = false AutoDropRemoteColumn = false )
Functions ¶
func StringCover ¶
func ToPostgreType ¶
func ToTableName ¶
Types ¶
type BaseModel ¶
type BaseModel[T any] struct { Type reflect.Type Dsn string Pool *pgxpool.Pool Database string Schema string TableName string // contains filtered or unexported fields }
func MustNewBaseModel ¶
func NewBaseModelWithCreated ¶
func (*BaseModel[T]) CountWhere ¶
func (*BaseModel[T]) DeleteWhere ¶
func (*BaseModel[T]) ExistsWhere ¶
func (*BaseModel[T]) FindAndUpdateSet ¶
func (*BaseModel[T]) FindWhere ¶
FindWhere finds a document (*struct type) that matches 'where' condition
func (*BaseModel[T]) GetCreateTableSQL ¶
func (*BaseModel[T]) GetIndexes ¶
func (b *BaseModel[T]) GetIndexes() ([]IndexSchema, error)
func (*BaseModel[T]) GetInsertReturningSQL ¶
GetInsertReturningSQL returns insert SQL with returning id
func (*BaseModel[T]) GetInsertSQL ¶
GetInsertSQL returns insert SQL without returning id
func (*BaseModel[T]) GetSelectFields ¶
id,name,create_at
func (*BaseModel[T]) GetSelectSQL ¶
GetSelectSQL returns fieldIndexes, and select SQL
func (*BaseModel[T]) Query ¶
QueryWhere queries documents ([]struct type) that matches 'where' condition
func (*BaseModel[T]) QueryAndUpdateSet ¶
func (*BaseModel[T]) QueryWhere ¶
QueryWhere queries documents ([]struct type) that matches 'where' condition
Source Files ¶
Click to show internal directories.
Click to hide internal directories.