types

package
v3.5.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package types defines some internal types that are handled by the "builder" and "stmt" package.

RawContext, StdContext and NamedContext are used to generate queries.

Index

Constants

View Source
const (
	// InnerJoin has a "INNER JOIN" type.
	InnerJoin = JoinType("INNER JOIN")
	// LeftJoin has a "LEFT JOIN" type.
	LeftJoin = JoinType("LEFT JOIN")
	// RightJoin has a "RIGHT JOIN" type.
	RightJoin = JoinType("RIGHT JOIN")
	// LeftOuterJoin has a "LEFT OUTER JOIN" type.
	LeftOuterJoin = JoinType("LEFT OUTER JOIN")
	// RightOuterJoin has a "RIGHT OUTER JOIN" type.
	RightOuterJoin = JoinType("RIGHT OUTER JOIN")
)

Join types.

View Source
const (
	And = LogicalOperator("AND")
	Or  = LogicalOperator("OR")
	Not = LogicalOperator("NOT")
)

Logical operators.

View Source
const (
	Equal              = ComparisonOperator("=")
	NotEqual           = ComparisonOperator("!=")
	Is                 = ComparisonOperator("IS")
	IsNot              = ComparisonOperator("IS NOT")
	GreaterThan        = ComparisonOperator(">")
	GreaterThanOrEqual = ComparisonOperator(">=")
	LessThan           = ComparisonOperator("<")
	LessThanOrEqual    = ComparisonOperator("<=")
	In                 = ComparisonOperator("IN")
	NotIn              = ComparisonOperator("NOT IN")
	Like               = ComparisonOperator("LIKE")
	NotLike            = ComparisonOperator("NOT LIKE")
	ILike              = ComparisonOperator("ILIKE")
	NotILike           = ComparisonOperator("NOT ILIKE")
	Between            = ComparisonOperator("BETWEEN")
	NotBetween         = ComparisonOperator("NOT BETWEEN")
	IsDistinctFrom     = ComparisonOperator("IS DISTINCT FROM")
	IsNotDistinctFrom  = ComparisonOperator("IS NOT DISTINCT FROM")
	Contains           = ComparisonOperator("@>")
	IsContainedBy      = ComparisonOperator("<@")
	Overlap            = ComparisonOperator("&&")
)

Comparison operators.

View Source
const (
	// Asc indicates forward order.
	Asc = OrderType("ASC")
	// Desc indicates reverse order.
	Desc = OrderType("DESC")
)

Order types.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComparisonOperator

type ComparisonOperator string

ComparisonOperator represents a comparison operator.

func (ComparisonOperator) String

func (e ComparisonOperator) String() string

type Context

type Context interface {
	Write(query string)
	Bind(value interface{})
}

A Context is passed to a root stmt.Statement to generate a query.

type JoinType

type JoinType string

JoinType represents a join type.

func (JoinType) String

func (e JoinType) String() string

type LogicalOperator

type LogicalOperator string

LogicalOperator represents a logical operator.

func (LogicalOperator) String

func (e LogicalOperator) String() string

type Map

type Map map[interface{}]interface{}

Map is a key/value map.

type NamedContext

type NamedContext struct {
	RawContext
	// contains filtered or unexported fields
}

NamedContext uses named query placeholders.

func (*NamedContext) Bind

func (ctx *NamedContext) Bind(value interface{})

Bind adds given value in context's values.

func (*NamedContext) Values

func (ctx *NamedContext) Values() map[string]interface{}

Values returns the named argument values.

type OrderType

type OrderType string

OrderType represents an order type.

func (OrderType) String

func (e OrderType) String() string

type Pair

type Pair struct {
	Key   interface{}
	Value interface{}
}

Pair is a key/value pair.

type RawContext

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

RawContext embeds values directly in the query.

func (*RawContext) Bind

func (ctx *RawContext) Bind(value interface{})

Bind adds given value in context's values.

func (*RawContext) Query

func (ctx *RawContext) Query() string

Query returns the underlaying query.

func (*RawContext) Write

func (ctx *RawContext) Write(query string)

Write appends given subquery in context's buffer.

type StdContext

type StdContext struct {
	RawContext
	// contains filtered or unexported fields
}

StdContext uses positional query placeholders.

func (*StdContext) Bind

func (ctx *StdContext) Bind(value interface{})

Bind adds given value in context's values.

func (*StdContext) Values

func (ctx *StdContext) Values() []interface{}

Values returns the positional argument values.

Jump to

Keyboard shortcuts

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