sdata

package
v0.15.61 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetColumns

func GetColumns(db *sql.DB, dbtype 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
	FKeySchema string
	FKeyTable  string
	FKeyCol    string
	Blocked    bool
	Table      string
}

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, blockList []string) ([]DBFunction, error)

type DBInfo

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

func GetDBInfo

func GetDBInfo(db *sql.DB, dbtype 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 {
		Ti   DBTableInfo
		ColL DBColumn
		ColR DBColumn
	}
	Left struct {
		Ti  DBTableInfo
		Col DBColumn
	}
	Right struct {
		VTable string
		Ti     DBTableInfo
		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) GetAliasTable added in v0.15.53

func (s *DBSchema) GetAliasTable(name, parent string) (string, bool)

func (*DBSchema) GetAliases added in v0.15.50

func (s *DBSchema) GetAliases(parent string) []string

func (*DBSchema) GetFunctions

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

func (*DBSchema) GetRel

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

func (*DBSchema) GetTableInfo

func (s *DBSchema) GetTableInfo(name, parent string) (DBTableInfo, error)

func (*DBSchema) GetTableInfoB

func (s *DBSchema) GetTableInfoB(name, parent string) (DBTableInfo, error)

func (*DBSchema) GetTableNames

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

func (*DBSchema) SetRel

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

func (*DBSchema) Type added in v0.15.57

func (s *DBSchema) Type() string

type DBTable

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

func GetTables

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

type DBTableInfo

type DBTableInfo struct {
	Name       string
	Type       string
	IsSingular bool
	IsAlias    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 (
	RelNone RelType = iota
	RelOneToOne
	RelOneToMany
	RelOneToManyThrough
	RelPolymorphic
	RelRecursive
	RelEmbedded
	RelRemote
	RelSkip
)

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