Documentation ¶
Index ¶
- func ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func Init(dsn string) error
- func NamedExec(query string, arg interface{}) (sql.Result, error)
- func NamedQuery(query string, arg interface{}) (*sqlx.Rows, error)
- func QueryRow(query string, args ...any) *sql.Row
- func Select(dest interface{}, query string, args ...interface{}) error
- func TypeToDbType(fieldType string) string
- type ITable
- type ModelCondition
- type Table
- func (t *Table[T, M]) Count() (int64, error)
- func (t *Table[T, M]) Get(pk any) (*M, error)
- func (t *Table[T, M]) GetWhere(whereFunc func(m T)) (*M, error)
- func (m *Table[T, M]) GetWhereConditions() []ModelCondition
- func (m *Table[T, M]) GetWhereParams() map[string]any
- func (t *Table[T, M]) Select(offset, limit int) ([]M, error)
- func (m *Table[T, M]) SetTable(table T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecContext ¶
func TypeToDbType ¶
Types ¶
type ITable ¶
type ITable[M any] interface { //NewModels() []*M GetConditions() []ModelCondition }
type ModelCondition ¶
type ModelCondition struct { //table *Table[T, M] Name string Type string DbColumn string DbType string DbCondition string DbOperator string Changed bool Value any }
func NewCondition ¶
func NewCondition(goName, goType, dbColumn, dbType string) ModelCondition
func (*ModelCondition) Eq ¶
func (m *ModelCondition) Eq(value any) *ModelCondition
type Table ¶
type Table[T ITable[M], M any] struct { TableName string // contains filtered or unexported fields }
func (*Table[T, M]) GetWhereConditions ¶
func (m *Table[T, M]) GetWhereConditions() []ModelCondition
func (*Table[T, M]) GetWhereParams ¶
Click to show internal directories.
Click to hide internal directories.