query

package
v0.0.0-...-0571e71 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileIndexCreation

func CompileIndexCreation(info QueryInfo, ifNotExists bool) []string

func CompileSQL

func CompileSQL(builder Builder, info QueryInfo) (string, []interface{})

func CompileTableCreation

func CompileTableCreation(info QueryInfo, ifNotExists bool) string

Types

type Aggregation

type Aggregation interface {
	GetAggregation() string
}

type And

type And []Clause

func (And) Condition

func (e And) Condition() string

func (And) IsValid

func (e And) IsValid(info QueryInfo) bool

func (And) Sql

func (e And) Sql(info QueryInfo) (string, []interface{})

type Builder

type Builder struct {
	Selections *utils.Set
	Omissions  *utils.Set
	Clauses    []Clause
	Orders     []Order
	Joins      []Join
	Limit      uint64
	Offset     uint64
	QueryType  Type
	IsCount    bool
	IsDistinct bool

	InsertValues []map[string]interface{}
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Join

func (b *Builder) Join(join Join) *Builder

func (*Builder) OrderBy

func (b *Builder) OrderBy(order Order) *Builder

func (*Builder) Where

func (b *Builder) Where(clause Clause) *Builder

type Clause

type Clause interface {
	Condition() string
	IsValid(info QueryInfo) bool
	Sql(info QueryInfo) (string, []interface{})
}

type ColumnOrder

type ColumnOrder struct {
	Column     string
	Descending bool
}

func (ColumnOrder) IsDescending

func (c ColumnOrder) IsDescending() bool

func (ColumnOrder) IsValid

func (c ColumnOrder) IsValid(info QueryInfo) bool

func (ColumnOrder) Sql

func (c ColumnOrder) Sql(info QueryInfo) (string, []interface{})

type Compiler

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

type CoveredBy

type CoveredBy struct {
	Column       string
	TargetColumn string
	Target       model.SpatialObject
}

Geography specific clauses

func (CoveredBy) Condition

func (c CoveredBy) Condition() string

func (CoveredBy) IsValid

func (c CoveredBy) IsValid(info QueryInfo) bool

func (CoveredBy) Sql

func (c CoveredBy) Sql(info QueryInfo) (string, []interface{})

type Covers

type Covers struct {
	Column       string
	TargetColumn string
	Target       model.SpatialObject
}

func (Covers) Condition

func (c Covers) Condition() string

func (Covers) IsValid

func (c Covers) IsValid(info QueryInfo) bool

func (Covers) Sql

func (c Covers) Sql(info QueryInfo) (string, []interface{})

type Equal

type Equal struct {
	Column      string
	OtherColumn string
	Value       interface{}
}

func (Equal) Condition

func (e Equal) Condition() string

func (Equal) IsValid

func (e Equal) IsValid(info QueryInfo) bool

func (Equal) Sql

func (e Equal) Sql(info QueryInfo) (string, []interface{})

type GreaterThan

type GreaterThan struct {
	Column      string
	OtherColumn string
	Value       interface{}
}

func (GreaterThan) Condition

func (e GreaterThan) Condition() string

func (GreaterThan) IsValid

func (e GreaterThan) IsValid(info QueryInfo) bool

func (GreaterThan) Sql

func (e GreaterThan) Sql(info QueryInfo) (string, []interface{})

type GreaterThanOrEqual

type GreaterThanOrEqual struct {
	Column      string
	OtherColumn string
	Value       interface{}
}

func (GreaterThanOrEqual) Condition

func (e GreaterThanOrEqual) Condition() string

func (GreaterThanOrEqual) IsValid

func (e GreaterThanOrEqual) IsValid(info QueryInfo) bool

func (GreaterThanOrEqual) Sql

func (e GreaterThanOrEqual) Sql(info QueryInfo) (string, []interface{})

type HasWithinRange

type HasWithinRange struct {
	Column       string
	TargetColumn string
	Targets      []model.SpatialObject
	Range        float64
}

func (HasWithinRange) Condition

func (h HasWithinRange) Condition() string

func (HasWithinRange) IsValid

func (h HasWithinRange) IsValid(info QueryInfo) bool

func (HasWithinRange) Sql

func (h HasWithinRange) Sql(info QueryInfo) (string, []interface{})

type Join

type Join struct {
	Schema      string
	OtherSchema string
	Type        JoinType
	JoinClause  Clause
}

func (Join) IsValid

func (j Join) IsValid(info QueryInfo) bool

func (Join) Sql

func (j Join) Sql(info QueryInfo) (string, []interface{})

type JoinType

type JoinType string
const (
	InnerJoin JoinType = "JOIN"
	OuterJoin JoinType = "OUTER JOIN"
	LeftJoin  JoinType = "LEFT JOIN"
	RightJoin JoinType = "RIGHT JOIN"
)

type LessThan

type LessThan struct {
	Column      string
	OtherColumn string
	Value       interface{}
}

func (LessThan) Condition

func (e LessThan) Condition() string

func (LessThan) IsValid

func (e LessThan) IsValid(info QueryInfo) bool

func (LessThan) Sql

func (e LessThan) Sql(info QueryInfo) (string, []interface{})

type LessThanOrEqual

type LessThanOrEqual struct {
	Column      string
	OtherColumn string
	Value       interface{}
}

func (LessThanOrEqual) Condition

func (e LessThanOrEqual) Condition() string

func (LessThanOrEqual) IsValid

func (e LessThanOrEqual) IsValid(info QueryInfo) bool

func (LessThanOrEqual) Sql

func (e LessThanOrEqual) Sql(info QueryInfo) (string, []interface{})

type Like

type Like struct {
	Column string
	Value  string
}

func (Like) Condition

func (e Like) Condition() string

func (Like) IsValid

func (e Like) IsValid(info QueryInfo) bool

func (Like) Sql

func (e Like) Sql(info QueryInfo) (string, []interface{})

type NotEqual

type NotEqual struct {
	Column      string
	OtherColumn string
	Value       interface{}
}

func (NotEqual) Condition

func (e NotEqual) Condition() string

func (NotEqual) IsValid

func (e NotEqual) IsValid(info QueryInfo) bool

func (NotEqual) Sql

func (e NotEqual) Sql(info QueryInfo) (string, []interface{})

type NotLike

type NotLike struct {
	Column string
	Value  string
}

func (NotLike) Condition

func (e NotLike) Condition() string

func (NotLike) IsValid

func (e NotLike) IsValid(info QueryInfo) bool

func (NotLike) Sql

func (e NotLike) Sql(info QueryInfo) (string, []interface{})

type Or

type Or []Clause

func (Or) Condition

func (e Or) Condition() string

func (Or) IsValid

func (e Or) IsValid(info QueryInfo) bool

func (Or) Sql

func (e Or) Sql(info QueryInfo) (string, []interface{})

type Order

type Order interface {
	IsDescending() bool
	IsValid(info QueryInfo) bool
	Sql(info QueryInfo) (string, []interface{})
}

type QueryInfo

type QueryInfo interface {
	HasSchema(schema string) bool
	HasField(field string) bool
	HasFieldOfType(field string, datatype model.DataType) bool
	GetField(field string) *model.Field
	GetMainSchema() model.Schema
	GetJoinSchemas() map[string]model.Schema
	GetAdapterInfo() adapter.AdapterInfo
}

type SpatialOrder

type SpatialOrder struct {
	Column       string
	Descending   bool
	Target       model.SpatialObject
	TargetColumn string
}

func (SpatialOrder) IsDescending

func (s SpatialOrder) IsDescending() bool

func (SpatialOrder) IsValid

func (s SpatialOrder) IsValid(info QueryInfo) bool

func (SpatialOrder) Sql

func (s SpatialOrder) Sql(info QueryInfo) (string, []interface{})

type Type

type Type string
const (
	SelectQuery Type = "SelectQueryType"
	InsertQuery Type = "InsertQueryType"
	UpdateQuery Type = "UpdateQueryType"
)

type WithinRangeOf

type WithinRangeOf struct {
	Column       string
	TargetColumn string
	Targets      []model.SpatialObject
	Range        float64
}

func (WithinRangeOf) Condition

func (w WithinRangeOf) Condition() string

func (WithinRangeOf) IsValid

func (w WithinRangeOf) IsValid(info QueryInfo) bool

func (WithinRangeOf) Sql

func (w WithinRangeOf) Sql(info QueryInfo) (string, []interface{})

Jump to

Keyboard shortcuts

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