sql_tpl

package
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CountTpl = `
SELECT
    COUNT(*)
FROM
    {{ .table_name }}
WHERE
    {{ range .conditions }} {{ . }} AND {{ end }} 1 = 1
`
View Source
const DeleteTpl = `
DELETE FROM
    {{ .table_name }}
WHERE
    {{ range .conditions }} {{ . }} AND {{ end }} 1 = 1
`
View Source
const InsertTpl = `` /* 288-byte string literal not displayed */
View Source
const QueryTpl = `` /* 269-byte string literal not displayed */
View Source
const UpdateTpl = `` /* 127-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterParsedStrValueOption added in v0.7.0

type AfterParsedStrValueOption func(strValue string) (string, error)

func WithAESKey added in v0.7.0

func WithAESKey(aesKey string) AfterParsedStrValueOption

type CheckExistExecuteParams

type CheckExistExecuteParams struct {
	TableName string
	*Conditions
}

func (CheckExistExecuteParams) Map

func (params CheckExistExecuteParams) Map() (map[string]any, error)

type CheckHasOnlyOneExecuteParams

type CheckHasOnlyOneExecuteParams struct {
	TableName string
	*Conditions
}

func (CheckHasOnlyOneExecuteParams) Map

func (params CheckHasOnlyOneExecuteParams) Map() (map[string]any, error)

type Conditions

type Conditions struct {
	Conditions []string
	// contains filtered or unexported fields
}

func NewConditions

func NewConditions() *Conditions

func (*Conditions) AddCondition

func (conditions *Conditions) AddCondition(condition string) *Conditions

func (*Conditions) Equal

func (conditions *Conditions) Equal(columnName string, value any, opts ...AfterParsedStrValueOption) *Conditions

func (*Conditions) GreaterThan

func (conditions *Conditions) GreaterThan(columnName string, value any, opts ...AfterParsedStrValueOption) *Conditions

func (*Conditions) GreaterThanAndEqual

func (conditions *Conditions) GreaterThanAndEqual(columnName string, value any, opts ...AfterParsedStrValueOption) *Conditions

func (*Conditions) In

func (conditions *Conditions) In(columnName string, value any, opts ...AfterParsedStrValueOption) *Conditions

func (*Conditions) LessThan

func (conditions *Conditions) LessThan(columnName string, value any, opts ...AfterParsedStrValueOption) *Conditions

func (*Conditions) LessThanAndEqual

func (conditions *Conditions) LessThanAndEqual(columnName string, value any, opts ...AfterParsedStrValueOption) *Conditions

func (*Conditions) Like

func (conditions *Conditions) Like(columnName string, value string, opts ...AfterParsedStrValueOption) *Conditions

func (*Conditions) Not

func (conditions *Conditions) Not(columnName string, value any, opts ...AfterParsedStrValueOption) *Conditions

func (*Conditions) NotIn

func (conditions *Conditions) NotIn(columnName string, value any, opts ...AfterParsedStrValueOption) *Conditions

type CountExecuteParams

type CountExecuteParams struct {
	TableName string
	*Conditions
}

func (CountExecuteParams) Map

func (params CountExecuteParams) Map() (map[string]any, error)

type DeleteExecuteParams

type DeleteExecuteParams struct {
	TableName string
	*Conditions
}

func (DeleteExecuteParams) Map

func (params DeleteExecuteParams) Map() (map[string]any, error)

type InsertBatchExecuteParams added in v0.9.0

type InsertBatchExecuteParams struct {
	TableName     string
	TableRowBatch []TableRow
}

func (InsertBatchExecuteParams) Map added in v0.9.0

func (params InsertBatchExecuteParams) Map() (map[string]any, error)

type InsertExecuteParams

type InsertExecuteParams struct {
	TableName string
	*TableRow
}

func (InsertExecuteParams) Map

func (params InsertExecuteParams) Map() (map[string]any, error)

type QueryExecuteParams

type QueryExecuteParams struct {
	TableName     string
	SelectColumns []string
	*Conditions
	PageNo   int
	PageSize int
}

func (QueryExecuteParams) Map

func (params QueryExecuteParams) Map() (map[string]any, error)

type QueryOneExecuteParams

type QueryOneExecuteParams struct {
	TableName     string
	SelectColumns []string
	*Conditions
}

func (QueryOneExecuteParams) Map

func (params QueryOneExecuteParams) Map() (map[string]any, error)

type TableRow

type TableRow struct {
	// contains filtered or unexported fields
}

func NewTableRow added in v0.9.0

func NewTableRow() *TableRow

func (*TableRow) Add added in v0.9.0

func (tableRow *TableRow) Add(column string, value any, opts ...AfterParsedStrValueOption) *TableRow

type UpdateExecuteParams

type UpdateExecuteParams struct {
	TableName string
	*TableRow
	*Conditions
}

func (UpdateExecuteParams) Map

func (params UpdateExecuteParams) Map() (map[string]any, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL