join

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(sw io.StringWriter, joinType JoinType, from string, match JoinMatcher) error

Join writes a JOIN clause to a strings.Builder.

Example:

LEFT JOIN table ON table.field = other_table.field AND table.field2 = other_table.field2
LEFT JOIN table USING (field, field2)

Types

type Clause

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

Clause represents a JOIN clause.

func New

func New(j []Options) *Clause

New creates a new join clause.

func (*Clause) Type

func (j *Clause) Type() clauses.ClauseType

func (*Clause) Write added in v0.0.3

func (j *Clause) Write(sw io.StringWriter) error

type JoinMatcher

type JoinMatcher interface {
	expressions.Expression
}

JoinMatcher is a join clause.

type JoinOn

type JoinOn struct {
	Predicates []predicates.Predicate
}

JoinOn is a join clause that uses a list of predicates to match.

Example:

LEFT JOIN table ON table.field = other_table.field AND table.field2 = other_table.field2

func (*JoinOn) Write added in v0.0.3

func (j *JoinOn) Write(sw io.StringWriter) error

type JoinType

type JoinType int
const (
	InnerJoin JoinType = iota
	LeftJoin
	RightJoin
	FullJoin
)

type JoinUsing

type JoinUsing struct {
	Uses []string
}

JoinUsing is a join clause that uses a list of columns to match.

Example:

LEFT JOIN table USING (field, field2)

func (*JoinUsing) Write added in v0.0.3

func (j *JoinUsing) Write(sw io.StringWriter) error

type Options

type Options struct {
	Type  JoinType
	From  string
	Match JoinMatcher // JoinOn or JoinUsing
}

Jump to

Keyboard shortcuts

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