sdata

package
v0.15.16-0...-9fff2f5 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetColumns

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

Types

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

	Blocked bool
	Ti      *DBTableInfo
	Table   string
	// contains filtered or unexported fields
}

func (*DBColumn) String

func (col *DBColumn) String() string

type DBFuncParam

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

type DBFunction

type DBFunction struct {
	Name   string
	Params []DBFuncParam
}

func GetFunctions

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

type DBInfo

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

func GetDBInfo

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

func GetTestDBInfo

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, error)

type DBRel

type DBRel struct {
	Type    RelType
	Through struct {
		ColL *DBColumn
		ColR *DBColumn
	}
	Left struct {
		Col *DBColumn
	}
	Right struct {
		VTable string
		Col    *DBColumn
	}
}

func (*DBRel) String

func (re *DBRel) String() string

type DBSchema

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

func GetTestSchema

func GetTestSchema() (*DBSchema, error)

func NewDBSchema

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

func (*DBSchema) DBVersion

func (s *DBSchema) DBVersion() int

func (*DBSchema) GetFunctions

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

func (*DBSchema) GetRel

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

func (*DBSchema) GetTableInfo

func (s *DBSchema) GetTableInfo(selName string) (*DBTableInfo, error)

func (*DBSchema) GetTableInfoB

func (s *DBSchema) GetTableInfoB(selName string) (*DBTableInfo, error)

func (*DBSchema) GetTableNames

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
	Blocked bool
}

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
	Singular   string
	Plural     string
	Blocked    bool
	Schema     *DBSchema
	// contains filtered or unexported fields
}

func (*DBTableInfo) ColumnExists

func (ti *DBTableInfo) ColumnExists(name string) bool

func (*DBTableInfo) GetColumn

func (ti *DBTableInfo) GetColumn(name string) (*DBColumn, error)

func (*DBTableInfo) GetColumnB

func (ti *DBTableInfo) GetColumnB(name string) (*DBColumn, error)

func (*DBTableInfo) String

func (ti *DBTableInfo) String() string

type RelType

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

func (RelType) String

func (i RelType) String() string

type VirtualTable

type VirtualTable struct {
	Name       string
	IDColumn   string
	TypeColumn string
	FKeyColumn string
}

Jump to

Keyboard shortcuts

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