Documentation ¶
Index ¶
- Variables
- func Connect(o InitConnect)
- func ForeachItemInterface(fiio ForeachItemInterfaceObj) (objs []interface{}, err error)
- func GetMysqlTimeFormat() string
- func InsertSet(now string, n string) string
- func MustBegin() *sqlx.Tx
- type Field
- type ForeachItemInterfaceObj
- type ForeachParam
- type InitConnect
- type InitObj
- type Parent
- func (p *Parent) AddField(f Field)
- func (p *Parent) ByteToDescribe(b []byte)
- func (p *Parent) Commit() (err error)
- func (p *Parent) CommitTx(txcommit bool) (err error)
- func (p *Parent) CreateFields() (err error)
- func (p *Parent) Delete() (err error)
- func (p *Parent) DescribeToByte() (b []byte)
- func (p *Parent) ForeachItem(param *ForeachParam, vals ...interface{}) (rows *sql.Rows, err error)
- func (p *Parent) Get(n string) (v interface{})
- func (p *Parent) GetBool(n string) (v bool)
- func (p *Parent) GetFiledsString() string
- func (p *Parent) GetFloat(n string) (v float64)
- func (p *Parent) GetFromDB(o *InitObj) (err error)
- func (p *Parent) GetInt(n string) (v int)
- func (p *Parent) GetInt64(n string) (v int64)
- func (p *Parent) GetIntArr(n string) (v []int)
- func (p *Parent) GetJson() (b []byte)
- func (p *Parent) GetMap() (m map[string]interface{})
- func (p *Parent) GetStr(n string) (v string)
- func (p *Parent) GetStrArr(n string) (v []string)
- func (p *Parent) GetTableName() string
- func (p *Parent) GetTime(n string) (v time.Time)
- func (p *Parent) ParseDbFields(rows *sql.Rows) (err error)
- func (p *Parent) Rollback() (err error)
- func (p *Parent) Set(n string, v interface{})
- func (p *Parent) SetSpecial(n, v string)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Dbh *sqlx.DB
)
Functions ¶
func ForeachItemInterface ¶
func ForeachItemInterface(fiio ForeachItemInterfaceObj) (objs []interface{}, err error)
Получаем группу интерфейсов из базы
Types ¶
type Field ¶
type Field struct { Name string Type string Value interface{} IsJson bool IsDb bool Null bool // contains filtered or unexported fields }
Объект значения строки
func (*Field) CheckNullValue ¶
func (f *Field) CheckNullValue(v interface{})
Проверяем не надо ли значение заменить на NULL
func (*Field) FormatTime ¶
Преобразование значения времени в строку понятную mysql
type ForeachItemInterfaceObj ¶
type ForeachItemInterfaceObj struct { NewFunc func(*InitObj) (interface{}, error) ForeachFunc func(interface{}, *ForeachParam, ...interface{}) (interface{}, *sql.Rows, error) ParseFunc func(interface{}, *sql.Rows) (interface{}, error) TxFunc func(interface{}) *sqlx.Tx Param *ForeachParam Vals []interface{} }
Объект для запроса группы интерфейсов
type ForeachParam ¶
type ForeachParam struct { OrderBy string Limit string GroupBy string Where string Fields string CondEntries []string ForUpdate bool }
Объект для запроса группы объектов
func (*ForeachParam) Clean ¶
func (fp *ForeachParam) Clean()
type InitConnect ¶
Объект конекта к базе
type InitObj ¶
type InitObj struct { PK string SKN string SKV string Fields string ForUpdate bool Tx *sqlx.Tx Empty bool }
Объект для инициализации значения из базы
type Parent ¶
type Parent struct { Fields []Field DbTable string PKey string SKeys []string MapAddFunc func(map[string]interface{}) Tx *sqlx.Tx Existed bool sync.RWMutex }
Родительский объект
func (*Parent) ByteToDescribe ¶
Сохраняем описание объекта
func (*Parent) CreateFields ¶
Формируем структуру объекта
func (*Parent) DescribeToByte ¶
Сохраняем описание объекта
func (*Parent) ForeachItem ¶
func (p *Parent) ForeachItem(param *ForeachParam, vals ...interface{}) (rows *sql.Rows, err error)
Получаем группу объектов
func (*Parent) GetFiledsString ¶
Формируем набор строк для запроса в mysql
func (*Parent) ParseDbFields ¶
Парсинг параметров полученных из базы
Click to show internal directories.
Click to hide internal directories.