Documentation
¶
Index ¶
- Variables
- func DoubleQuotes(val string) string
- func Generate(ctx context.Context, opts GenerateCmdOpts) error
- func NewTemplateSet(ctx context.Context) (*templates.Set, error)
- func StringWithWithoutComma(len int, i int, val string) string
- func TrimQuotes(val string) string
- func VALUE[V any](c Column[V], value V) V
- type Column
- type ColumnOrder
- type ColumnType
- type ColumnWithTable
- type CompareOperator
- type GenerateCmdOpts
- type NameWithAliaser
- type OrderDirection
- type QueryOptions
- type Statement
- func AND(c ...Statement) Statement
- func AS(a StatementType, b StatementType) Statement
- func AggregateStatements(queries ...Statement) Statement
- func COUNT[V any](column Column[V]) Statement
- func CROSS_JOIN(table NameWithAliaser, on Statement) Statement
- func Compare[V any](c Column[V], operator CompareOperator, value V) Statement
- func CompareColumns[A any, B any](a Column[A], operator CompareOperator, b Column[B]) Statement
- func DELETE_FROM(t TableType) Statement
- func EQUAL[V any](c Column[V], value V) Statement
- func EQUAL_COLUMNS[A any, B any](a Column[A], b Column[B]) Statement
- func FROM(table NameWithAliaser) Statement
- func FROM_RAW(sq Statement) Statement
- func FULL_JOIN(table NameWithAliaser, on Statement) Statement
- func GREATER[V any](c Column[V], value V) Statement
- func GREATER_OR_EQUAL[V any](c Column[V], value V) Statement
- func GROUP_BY(c ...ColumnWithTable) Statement
- func ILIKE[V any](c Column[V], value V) Statement
- func IN[V any](c Column[V], value V) Statement
- func INNER_JOIN(table NameWithAliaser, on Statement) Statement
- func INSERT_INTO(t TableType, columns ...ColumnType) Statement
- func LEFT_JOIN(table NameWithAliaser, on Statement) Statement
- func LESS[V any](c Column[V], value V) Statement
- func LESS_OR_EQUAL[V any](c Column[V], value V) Statement
- func LIKE[V any](c Column[V], value V) Statement
- func LIMIT(limit int) Statement
- func NOT_EQUAL[V any](c Column[V], value V) Statement
- func NOT_IN[V any](c Column[V], value V) Statement
- func NewEmptyStatement() Statement
- func NewStatement(sql string, args ...interface{}) Statement
- func OFFSET(limit int) Statement
- func OR(c ...Statement) Statement
- func ORDER_BY(c ...ColumnOrder) Statement
- func Query(exprs ...Statement) (Statement, error)
- func QueryMust(exprs ...Statement) Statement
- func QueryWithOptions(options QueryOptions, exprs ...Statement) (Statement, error)
- func RETURNING(c ...ColumnType) Statement
- func RIGHT_JOIN(table NameWithAliaser, on Statement) Statement
- func SELECT(columns ...ColumnType) Statement
- func SELECT_FROM(table TableType, columns ...ColumnType) (Statement, error)
- func SELECT_FROM_P(table TableType, columns ...ColumnType) Statement
- func SET(c ...Statement) Statement
- func SET_VALUE[V any](c Column[V], value V) Statement
- func SET_VALUE_COLUMN[A any, B any](a Column[A], b Column[B]) Statement
- func SetArgsSequence(val Statement) Statement
- func StatementFromTableAlias(table TableType) Statement
- func SubQuery(exprs ...Statement) Statement
- func TABLE_WITH_COLUMNS(t TableType, columns ...ColumnType) Statement
- func UPDATE(t TableType) Statement
- func VALUES(valueGroupList ...ValuesSetSt) Statement
- func WHERE(c Statement) Statement
- func WITH(t Statement) Statement
- func (s Statement) GetAlias() string
- func (s Statement) GetAliasWithTableAlias() string
- func (s Statement) GetArguments() []interface{}
- func (s Statement) GetName() string
- func (s Statement) GetNameAsAlias() string
- func (s Statement) GetSQL() string
- func (s Statement) GetStatement() Statement
- func (s Statement) String() string
- type StatementType
- type Table
- func (t Table) AllColumns() Column[string]
- func (t Table) As(alias string) TableType
- func (t Table) GetAlias() string
- func (t Table) GetAliasAsStatement() Statement
- func (t Table) GetColumnsNames() []string
- func (t Table) GetColumnsNamesMap() map[string]bool
- func (t Table) GetName() string
- func (t Table) GetNameWithAlias() string
- func (t Table) GetStatement() Statement
- type TableType
- type UUIDArray
- type ValidationError
- type ValuesSetSt
Constants ¶
This section is empty.
Variables ¶
View Source
var ASC = OrderDirection{
Value: "ASC",
}
View Source
var AllColumn = Column[string]{"*", "*", "", ""}
View Source
var DESC = OrderDirection{
Value: "DESC",
}
View Source
var Equal = CompareOperator{
Value: "=",
}
View Source
var Greater = CompareOperator{
Value: ">",
}
View Source
var GreaterOrEqual = CompareOperator{
Value: ">=",
}
View Source
var ILike = CompareOperator{
Value: "ILIKE",
}
View Source
var In = CompareOperator{
Value: "IN",
}
View Source
var Less = CompareOperator{
Value: "<",
}
View Source
var LessOrEqual = CompareOperator{
Value: "<=",
}
View Source
var Like = CompareOperator{
Value: "LIKE",
}
View Source
var NotEqual = CompareOperator{
Value: "!=",
}
View Source
var NotIn = CompareOperator{
Value: "NOT IN",
}
View Source
var QUERY_ARG = "$$DIO_ARG$$"
View Source
var XoTemplates embed.FS
Functions ¶
func DoubleQuotes ¶
func TrimQuotes ¶
Types ¶
type Column ¶
type Column[V any] struct { ColumnName string ColumnAlias string TableName string TableAlias string }
func NewColumnWithAlias ¶
func (Column[V]) GetAliasWithTableAlias ¶
func (Column[V]) GetNameAsAlias ¶
func (Column[V]) GetStatement ¶
type ColumnOrder ¶
type ColumnOrder struct { ColumnWithTable Direction OrderDirection }
func NewColumnOrder ¶
func NewColumnOrder(table TableType, column ColumnType, direction OrderDirection) ColumnOrder
func (ColumnOrder) String ¶
func (c ColumnOrder) String() string
type ColumnType ¶
type ColumnWithTable ¶
type ColumnWithTable struct { Table TableType Column ColumnType }
func NewColumnWithTable ¶
func NewColumnWithTable(table TableType, column ColumnType) ColumnWithTable
func (ColumnWithTable) GetAlias ¶
func (c ColumnWithTable) GetAlias() string
type CompareOperator ¶
type CompareOperator struct {
Value string
}
func (CompareOperator) String ¶
func (c CompareOperator) String() string
type GenerateCmdOpts ¶
type NameWithAliaser ¶
type NameWithAliaser interface {
GetNameWithAlias() string
}
type OrderDirection ¶
type OrderDirection struct {
Value string
}
type QueryOptions ¶
type Statement ¶
type Statement struct { SQL string Args []interface{} }
func AS ¶
func AS(a StatementType, b StatementType) Statement
func AggregateStatements ¶
func CROSS_JOIN ¶
func CROSS_JOIN(table NameWithAliaser, on Statement) Statement
func CompareColumns ¶
func FROM ¶
func FROM(table NameWithAliaser) Statement
func FULL_JOIN ¶
func FULL_JOIN(table NameWithAliaser, on Statement) Statement
func GREATER_OR_EQUAL ¶
func GROUP_BY ¶
func GROUP_BY(c ...ColumnWithTable) Statement
func INNER_JOIN ¶
func INNER_JOIN(table NameWithAliaser, on Statement) Statement
func INSERT_INTO ¶
func INSERT_INTO(t TableType, columns ...ColumnType) Statement
func LEFT_JOIN ¶
func LEFT_JOIN(table NameWithAliaser, on Statement) Statement
func LESS_OR_EQUAL ¶
func NewEmptyStatement ¶
func NewEmptyStatement() Statement
func NewStatement ¶
func ORDER_BY ¶
func ORDER_BY(c ...ColumnOrder) Statement
func QueryWithOptions ¶
func QueryWithOptions(options QueryOptions, exprs ...Statement) (Statement, error)
func RETURNING ¶
func RETURNING(c ...ColumnType) Statement
func RIGHT_JOIN ¶
func RIGHT_JOIN(table NameWithAliaser, on Statement) Statement
func SELECT ¶
func SELECT(columns ...ColumnType) Statement
func SELECT_FROM ¶ added in v0.1.6
func SELECT_FROM( table TableType, columns ...ColumnType, ) (Statement, error)
SELECT_FROM validates the columns against the table's column names and returns a Statement. If any column is not found in the table, an error is returned. This function is useful for ensuring that the columns being selected are valid
func SELECT_FROM_P ¶ added in v0.1.6
func SELECT_FROM_P( table TableType, columns ...ColumnType, ) Statement
SELECT_FROM_P same as SELECT_FROM, but panic
func SetArgsSequence ¶
func StatementFromTableAlias ¶
func TABLE_WITH_COLUMNS ¶
func TABLE_WITH_COLUMNS(t TableType, columns ...ColumnType) Statement
func VALUES ¶
func VALUES(valueGroupList ...ValuesSetSt) Statement
func (Statement) GetAliasWithTableAlias ¶
func (Statement) GetArguments ¶
func (s Statement) GetArguments() []interface{}
func (Statement) GetNameAsAlias ¶
func (Statement) GetStatement ¶
type StatementType ¶
type StatementType interface {
GetStatement() Statement
}
type Table ¶
func NewTableSt ¶
func (Table) AllColumns ¶
func (Table) GetAliasAsStatement ¶
func (Table) GetColumnsNames ¶ added in v0.1.6
func (Table) GetColumnsNamesMap ¶ added in v0.1.6
func (Table) GetNameWithAlias ¶
func (Table) GetStatement ¶
type UUIDArray ¶
func NewUUIDArray ¶
type ValidationError ¶ added in v0.1.6
type ValidationError struct {
Msg string
}
func (*ValidationError) Error ¶ added in v0.1.6
func (e *ValidationError) Error() string
type ValuesSetSt ¶
type ValuesSetSt []interface{}
func ValueSet ¶
func ValueSet(values ...interface{}) ValuesSetSt
Source Files
¶
Click to show internal directories.
Click to hide internal directories.