query

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queryable

type Queryable struct {
	Target     Target
	Specifier  Selectable
	Joins      []Queryable
	SelectOnly bool
	// contains filtered or unexported fields
}

Queryable represents an abstract entity that you can run query against.

func (Queryable) String

func (q Queryable) String() string

String is a string representation of Queryable

func (Queryable) ToQuery

func (q Queryable) ToQuery() (string, error)

ToQuery converts the Queryable to a SQL query.

func (Queryable) Where

func (q Queryable) Where(where string) Queryable

Where specifies the sql WHERE clause for the queryable.

func (Queryable) With

func (q Queryable) With(queryables ...Queryable) Queryable

With appends "child" Queryables to the target Queryable which will be included in the resulting parent data object.

type Selectable

type Selectable interface {
	// Selects returns a list of column names as appeared
	// in a select query.
	Selects() []string
}

Selectable is the interface describing the relations a select query can be run for.

type Target

type Target int

Target represents a single, non-recursive queryable target. It's usually a relation (tables, views) but can be a function result.

const (
	TargetUnspecified Target = iota
	TargetLocks
	TargetLocksOnTxID
	TargetStatActivity
	TargetStatReplication
	TargetStatSSL
	TargetStatGSSAPI
	TargetStatWALReceiver
	TargetStatSubscription
	TargetStatDatabase
	TargetStatDatabaseConflicts
	TargetStatUserTables
	TargetStatUserIndexes
	TargetStatIOUserIndexes
	TargetStatIOUserSequences
	TargetStatIOUserTables
	TargetStatUserFunctions
	TargetStatArchiver
	TargetStatBGWriter
	TargetStatSLRU

	TargetBlockingPIDs
)

Targets defined

func (Target) GetJoinClauses

func (t Target) GetJoinClauses(join Target) (string, string, string, error)

GetJoinClauses returns the relation alias, column alias, and join condition between the target and the target it's being joined with.

func (Target) String

func (t Target) String() string

String returns the stringified target.

Jump to

Keyboard shortcuts

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