metasql

package
v0.0.0-...-966525a Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Keywords []string // The keyword tokens
View Source
var Lexer *lex.Lexer // The lexer object. Use this to construct a Scanner
View Source
var Literals []string // The tokens representing literal strings
View Source
var TokenIds map[string]int // A map from the token names to their int ids
View Source
var Tokens []string // All of the tokens (including literals and keywords)

Functions

func Generate

func Generate(dta interface{}, txtFile string) error

Generate assumes that the primary ID is in the first column (index 0)

func ProcessState

func ProcessState(sm *StateMachine, token *lex.Token) (err error)

Types

type Column

type Column struct {
	Name      string
	Type      string
	Ref       bool //if true is foreign key
	Not       bool //true if Not seen in column (can refer to Null or Deferrable)
	Null      bool //column is Not Null or Null (default)
	Generated bool //true if GENERATED in column
}

type FileName

type FileName struct {
	Name   string
	Prefix bool
}

type GenerateFunc

type GenerateFunc func(int, int, Column) string

type NextAction

type NextAction struct {
	State int
	Fn    func(*StateMachine, *lex.Token)
}

type StateMachine

type StateMachine struct {
	FName    string //sql fil
	CurState int
	Tables   []Table
}

func InitState

func InitState(fname string) *StateMachine

func ReadSM

func ReadSM() (sm *StateMachine, err error)

func (*StateMachine) DataPath

func (sm *StateMachine) DataPath() string

func (*StateMachine) FilePrefix

func (sm *StateMachine) FilePrefix() string

func (*StateMachine) Import

func (sm *StateMachine) Import() string

func (*StateMachine) ImportSQL

func (sm *StateMachine) ImportSQL() string

func (*StateMachine) ImportTime

func (sm *StateMachine) ImportTime(ignoreNull bool) string

func (*StateMachine) Package

func (sm *StateMachine) Package() string

func (*StateMachine) ProjName

func (sm *StateMachine) ProjName() string

func (*StateMachine) ReverseTables

func (sm *StateMachine) ReverseTables() (result []Table)

type Table

type Table struct {
	Name    string
	Query   string
	Columns []Column
}

func (Table) CapPlurName

func (table Table) CapPlurName() string

rename CapName => CapPlurName

func (Table) CapSingName

func (table Table) CapSingName() string

func (Table) CompareMapFields

func (table Table) CompareMapFields() string

func (Table) CreateQuery

func (table Table) CreateQuery() string

func (Table) CreateStatement

func (table Table) CreateStatement() string

func (Table) CreateTableStatement

func (table Table) CreateTableStatement() string

func (Table) DeleteAllStatement

func (table Table) DeleteAllStatement() string

func (Table) DeleteQuery

func (table Table) DeleteQuery() string

func (Table) DeleteStatement

func (table Table) DeleteStatement() string

func (Table) DropTableStatement

func (table Table) DropTableStatement() string

func (Table) PlurName

func (table Table) PlurName() string

new

func (Table) RetrieveAllStatement

func (table Table) RetrieveAllStatement() string

func (Table) RetrieveStatement

func (table Table) RetrieveStatement() string

func (Table) ScanAll

func (table Table) ScanAll() string

func (Table) SingName

func (table Table) SingName() string

func (Table) Star

func (table Table) Star() string

func (Table) StructFields

func (table Table) StructFields() string

func (Table) TestData

func (table Table) TestData(dataid int) string

func (Table) UpdateQuery

func (table Table) UpdateQuery() string

func (Table) UpdateStatement

func (table Table) UpdateStatement() string

Jump to

Keyboard shortcuts

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