Documentation
¶
Index ¶
Constants ¶
const ( // JoinLeft LEFT JOIN тип. JoinLeft = "left" // JoinRight RIGHT JOIN тип. JoinRight = "right" // JoinInner INNER JOIN тип. JoinInner = "inner" )
Variables ¶
var SqlBuilderVal sqlBuilder
Functions ¶
This section is empty.
Types ¶
type FieldTagFlags ¶
type FieldTagFlags struct {
IsPK bool // keyPK
ReadOnly bool // keyRO
AutoGen bool // keyAuto
Embed bool
ForceUpdate bool
ForceInsert bool
SkipReading bool
ColName string // keyColName
Prefix string // keyPrefix
Ref string
Sort string
}
func (*FieldTagFlags) Merge ¶
func (f *FieldTagFlags) Merge(parent FieldTagFlags)
type JoinCondition ¶
type JoinCondition struct {
TargetAlias string // алиас referenced таблицы / alias of referenced table
TargetColumn string // referenced column name
SourceColumn string // колонка в source таблице с ref= / column in source table with ref=
}
JoinCondition описывает условие ON для JOIN. EN: JoinCondition describes an ON condition for JOIN.
type QueryInfo ¶
type QueryInfo struct {
Tables []QueryTableInfo
FromIdx int
PKIdx int
CombinedFields TableFields
SelectIdxList []int
SortIdxList []int
FieldNameIdx map[string]int
}
QueryInfo полная метаинформация для Query[T]. EN: QueryInfo full metadata for Query[T].
type QuerySqlTexts ¶
type QuerySqlTexts struct {
GetOne string // SELECT ... FROM ... JOINs ... WHERE pk = $1
ListStart string // SELECT ... FROM ... JOINs ...
SortPart string // ORDER BY ...
}
QuerySqlTexts SQL тексты для Query[T]. EN: QuerySqlTexts SQL texts for Query[T].
func BuildQuerySqlTexts ¶
func BuildQuerySqlTexts(d dialect.SQLDialect, qi *QueryInfo) QuerySqlTexts
BuildQuerySqlTexts строит SQL тексты для Query на основе QueryInfo. EN: BuildQuerySqlTexts builds SQL texts for Query based on QueryInfo.
type QueryTableInfo ¶
type QueryTableInfo struct {
TableInfo TableInfo
Alias string
JoinType string // "left", "right", "inner"
IsFrom bool
IsPK bool
IsPointer bool
FieldIndex int
SortPos int
RefMap map[string]string
JoinConds []JoinCondition
}
QueryTableInfo метаинформация для одной таблицы в Query. EN: QueryTableInfo metadata for one table in Query.
type QueryTagFlags ¶
type QueryTagFlags struct {
IsFrom bool
JoinType string // "left", "right", "inner", "" (auto)
Alias string // SQL alias for this table
RefMap map[string]string // ref-table-name → alias
IsPK bool
IsOmit bool
SortPos int
}
QueryTagFlags флаги тега tbl на полях Query-структуры. EN: QueryTagFlags flags of the tbl tag on Query struct fields.
func ParseQueryTag ¶
func ParseQueryTag(tag string) (QueryTagFlags, error)
ParseQueryTag парсит тег tbl на полях Query-структуры. EN: ParseQueryTag parses the tbl tag on Query struct fields.
type TableField ¶
type TableFields ¶
type TableFields []TableField
func CollectTableFields ¶
func CollectTableFields(t reflect.Type) (TableFields, error)
func (TableFields) ExtractArgs ¶
func (tfs TableFields) ExtractArgs(src any, indexes []int) []any
func (TableFields) ExtractRefs ¶
func (tfs TableFields) ExtractRefs(src any, indexes []int) (refs []any)