sql

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clause

func Clause(op LogicalOperator, mods ...string) string

func Column

func Column(table, column string) string

func ConvertQuestionMarks added in v1.2.0

func ConvertQuestionMarks(sql string) string

func Expr

func Expr(s string) string

func GeneratePlaceholders added in v1.2.0

func GeneratePlaceholders(count int) []string

func Group

func Group(s ...string) string

func Query

func Query(c ...string) string

func QueryEnd added in v1.2.0

func QueryEnd(s string) string

func Where

func Where(s string, op Operator, v ...string) string

func WhereComposite

func WhereComposite[T any](op Operator, cols []T, f func(c T) string) string

func WhereEndsWith

func WhereEndsWith(s string, v any) (string, any)

func WhereIn

func WhereIn(s string, v any) (string, any)

func WhereLike

func WhereLike(s string, v any) (string, any)

func WhereNotIn

func WhereNotIn(s string, v any) (string, any)

func WhereNotLike

func WhereNotLike(s string, v any) (string, any)

func WhereStartsWith

func WhereStartsWith(s string, v any) (string, any)

Types

type LogicalOperator

type LogicalOperator string
const (
	AND      LogicalOperator = "AND"
	OR       LogicalOperator = "OR"
	ORDER_BY LogicalOperator = "ORDER BY"
)

func (LogicalOperator) String

func (lo LogicalOperator) String(space bool) string

type Operator

type Operator string
const (
	Equal              Operator = "="
	NotEqual           Operator = "!="
	GreaterThan        Operator = ">"
	GreaterThanOrEqual Operator = ">="
	LessThan           Operator = "<"
	LessThanOrEqual    Operator = "<="
	In                 Operator = "IN"
	NotIn              Operator = "NOT IN"
	Like               Operator = "LIKE"
	ILike              Operator = "ILIKE"
	NotLike            Operator = "NOT LIKE"
	IsNull             Operator = "IS NULL"
	IsNotNull          Operator = "IS NOT NULL"
)

func (Operator) String

func (o Operator) String() string

type Order

type Order string
var (
	ASC  Order = "ASC"
	DESC Order = "DESC"
)

func (Order) IsValid

func (o Order) IsValid() bool

func (Order) String

func (o Order) String() string

Jump to

Keyboard shortcuts

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