psql

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

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

func NewCompiler

func NewCompiler(conf Config) *Compiler

func (*Compiler) AddRelationship

func (co *Compiler) AddRelationship(child, parent string, rel *DBRel) error

func (*Compiler) Compile

func (co *Compiler) Compile(w io.Writer, qc *qcode.QCode, vars Variables) (Metadata, error)

func (*Compiler) CompileEx

func (co *Compiler) CompileEx(qc *qcode.QCode, vars Variables) (Metadata, []byte, error)

func (*Compiler) IDColumn

func (co *Compiler) IDColumn(table string) (*DBColumn, error)

type Config

type Config struct {
	Schema *DBSchema
	Vars   map[string]string
}

type DBColumn

type DBColumn struct {
	ID         int16
	Name       string
	Key        string
	Type       string
	Array      bool
	NotNull    bool
	PrimaryKey bool
	UniqueKey  bool
	FKeyTable  string
	FKeyColID  []int16
	// contains filtered or unexported fields
}

func GetColumns

func GetColumns(db *sql.DB, schema, table string) ([]DBColumn, error)

type DBFuncParam added in v0.13.17

type DBFuncParam struct {
	ID   int
	Name sql.NullString
	Type string
}

type DBFunction added in v0.13.17

type DBFunction struct {
	Name   string
	Params []DBFuncParam
}

func GetFunctions added in v0.13.17

func GetFunctions(db *sql.DB, schema string) ([]DBFunction, error)

type DBInfo

type DBInfo struct {
	Version   int
	Tables    []DBTable
	Columns   [][]DBColumn
	Functions []DBFunction
	// contains filtered or unexported fields
}

func GetDBInfo

func GetDBInfo(db *sql.DB, schema string) (*DBInfo, error)

func GetTestDBInfo added in v0.13.18

func GetTestDBInfo() *DBInfo

func (*DBInfo) AddTable

func (di *DBInfo) AddTable(t DBTable, cols []DBColumn)

func (*DBInfo) GetColumn

func (di *DBInfo) GetColumn(table, column string) (*DBColumn, bool)

type DBRel

type DBRel struct {
	Type    RelType
	Through string
	ColT    string
	Left    struct {
		Table string
		Col   string
		Array bool
		// contains filtered or unexported fields
	}
	Right struct {
		Table string
		Col   string
		Array bool
		// contains filtered or unexported fields
	}
}

func (*DBRel) String

func (re *DBRel) String() string

type DBSchema

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

func GetTestSchema added in v0.13.18

func GetTestSchema() (*DBSchema, error)

func NewDBSchema

func NewDBSchema(info *DBInfo, aliases map[string][]string) (*DBSchema, error)

func (*DBSchema) GetFunctions added in v0.13.17

func (s *DBSchema) GetFunctions() []*DBFunction

func (*DBSchema) GetRel

func (s *DBSchema) GetRel(child, parent string) (*DBRel, error)

func (*DBSchema) GetTable

func (s *DBSchema) GetTable(table string) (*DBTableInfo, error)

func (*DBSchema) GetTableNames added in v0.13.15

func (s *DBSchema) GetTableNames() []string

func (*DBSchema) SetRel

func (s *DBSchema) SetRel(child, parent string, rel *DBRel) error

type DBTable

type DBTable struct {
	ID   int
	Name string
	Key  string
	Type string
}

func GetTables

func GetTables(db *sql.DB, schema string) ([]DBTable, error)

type DBTableInfo

type DBTableInfo struct {
	Name       string
	Type       string
	IsSingular bool
	Columns    []DBColumn
	PrimaryCol *DBColumn
	TSVCol     *DBColumn
	ColMap     map[string]*DBColumn
	ColIDMap   map[int16]*DBColumn
	Singular   string
	Plural     string
}

type IntStack

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

func NewIntStack

func NewIntStack() *IntStack

Create a new IntStack

func (*IntStack) Len

func (s *IntStack) Len() int

Return the number of items in the IntStack

func (*IntStack) Peek

func (s *IntStack) Peek() int32

View the top item on the IntStack

func (*IntStack) Pop

func (s *IntStack) Pop() int32

Pop the top item of the IntStack and return it

func (*IntStack) Push

func (s *IntStack) Push(value int32)

Push a value onto the top of the IntStack

type Metadata added in v0.13.38

type Metadata struct {
	Skipped uint32
	Params  []Param
	// contains filtered or unexported fields
}

type Param added in v0.13.38

type Param struct {
	Name    string
	Type    string
	IsArray bool
}

type RelType

type RelType int
const (
	RelOneToOne RelType = iota + 1
	RelOneToMany
	RelOneToManyThrough
	RelEmbedded
	RelRemote
)

func (RelType) String

func (rt RelType) String() string

type Variables

type Variables map[string]json.RawMessage

Jump to

Keyboard shortcuts

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