sqrible

package
v0.0.0-...-9edd19e Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTemplate

func ApplyTemplate(t *Table, templateDir string, templateName string) ([]byte, error)

func Quit

func Quit(e error)

Types

type Column

type Column struct {
	PGColumnName      string
	PGDataType        string
	PGUDTName         string
	PGOrdinalPosition int32

	IsPK bool

	GoFieldName string
	PgxType     string

	Config *TableColumnConfigDetails
}

func (*Column) IsConfigured

func (c *Column) IsConfigured() bool

func (*Column) IsInsertable

func (c *Column) IsInsertable() bool

func (*Column) IsSelectable

func (c *Column) IsSelectable() bool

func (*Column) IsUpdateable

func (c *Column) IsUpdateable() bool

func (*Column) JSON

func (c *Column) JSON() string

type Columns

type Columns []*Column

func (Columns) GoNames

func (c Columns) GoNames() []string

func (Columns) PGNames

func (c Columns) PGNames() []string

type Config

type Config struct {
	Tables map[string]TableConfig
}

func ParseConfig

func ParseConfig(f string) Config

func (Config) TableConfigurationProvided

func (c Config) TableConfigurationProvided(tn string) bool

type Table

type Table struct {
	Name         string
	Columns      Columns
	GoStructName string
	Template     string
}

func NewTable

func NewTable(name string, cols Columns, cfg *TableConfig) *Table

func ProcessTable

func ProcessTable(c *pgx.Conn, n string, cfg Config) *Table

func (*Table) InsertableColumns

func (t *Table) InsertableColumns() Columns

func (*Table) Pks

func (t *Table) Pks() Columns

func (*Table) SelectableColumns

func (t *Table) SelectableColumns() Columns

func (*Table) UpdateableColumns

func (t *Table) UpdateableColumns() Columns

type TableColumnConfigDetails

type TableColumnConfigDetails struct {
	Access string `yaml:"access"`
	JSON   string `yaml:"json"`
}

func (TableColumnConfigDetails) IsIgnored

func (d TableColumnConfigDetails) IsIgnored() bool

func (TableColumnConfigDetails) IsInsertable

func (d TableColumnConfigDetails) IsInsertable() bool

func (TableColumnConfigDetails) IsSelectable

func (d TableColumnConfigDetails) IsSelectable() bool

func (TableColumnConfigDetails) IsUpdateable

func (d TableColumnConfigDetails) IsUpdateable() bool

type TableConfig

type TableConfig struct {
	Template      string                              `yaml:"template"`
	ConfigDetails map[string]TableColumnConfigDetails `yaml:"tablecols"`
	GoStruct      string
}

Jump to

Keyboard shortcuts

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