Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertColumnName(uniqueNames map[string]bool, name string) string
- func ConvertName(name string) string
- func CreateQualifiedNames(names []string, dialect string) (qName string, err error)
- func DiffJSON(a, b string) string
- func GetQuotes(dialect string) (startQuote string, endQuote string, err error)
- func IsAlpha(c byte) bool
- func IsColumnExpressionAtomic(expression string) bool
- func IsReservedWord(w string) bool
- func IsStringInSlice(str string, list []string) bool
- func IsValidID(value string) bool
- func ParseSML(input, projectName string) (project Project, parseErrors []ParseError)
- func RandomString(n int) string
- func RemoveExtraSpaces(s string) string
- type Column
- type Comment
- type CriteriaCombinationTerm
- type CriteriaSimpleTerm
- type CriteriaTerm
- type Dataset
- type JInGo
- type JType
- type Join
- type Namespace
- type OperatorTableSQL
- type ParseError
- type Project
- type SQLToken
- type SQLTokenType
- type Scheme
- type StringSet
- type Table
Constants ¶
const ( TypeBool = "bool" TypeDatetime = "datetime" TypeFloat = "float" TypeInt = "int" TypeString = "string" TypeTime = "time" TypeVerbatim = "verbatim" )
define SML data types
const Debug = false
const (
DialectDuckDB = "duckdb"
)
Datasource provider constants
Variables ¶
var Assert = func() func(bool) { if Debug { return assert } return func(bool) {} }()
var DataTypes = map[string]bool{ TypeString: true, TypeVerbatim: true, TypeInt: true, TypeFloat: true, TypeDatetime: true, TypeBool: true, TypeTime: true, }
DataTypes ...
var SQL_RESERVED_WORDS = makeReservedWords()
var UNIVERSAL_TYPE_TO_CLICKHOUSE = map[string]string{
"TINYINT": "Int16",
"SMALLINT": "Int32",
"INT": "Int64",
"INTEGER": "Int64",
"BIGINT": "Int64",
"INT8": "Int8",
"INT16": "Int16",
"INT32": "Int32",
"INT64": "Int64",
"UINT8": "UInt8",
"UINT16": "UInt16",
"UINT32": "UInt32",
"UINT64": "UInt64",
"DECIMAL": "Float64",
"DOUBLE": "Float64",
"FLOAT": "Float64",
"FLOAT32": "Float32",
"FLOAT64": "Float64",
"NUMERIC": "Float64",
"REAL": "Float64",
"CHAR": "String",
"VARCHAR": "String",
"STRING": "String",
"TEXT": "String",
"FIXEDSTRING": "String",
"TIME": "DateTime",
"TIMESTAMP": "DateTime",
"DATE": "Date",
"DATETIME": "DateTime",
"BOOL": "Boolean",
"BOOLEAN": "Boolean",
}
Functions ¶
func ConvertName ¶
func CreateQualifiedNames ¶
CreateQualifiedNames creates a qualified name using "names" by combining them based on the dialect.
func IsColumnExpressionAtomic ¶
IsColumnExpressionAtomic takes an expression and returns true if the expression is atomic
func IsReservedWord ¶
func IsStringInSlice ¶
IsStringInSlice returns true if the string is present in the slice
func IsValidID ¶
IsValidID checks if a name is a valid id id definition:
minimum length has to be 1 1st character can only be undersore or alphabets 2nd character onwards can be alphanumeric and undersores
func ParseSML ¶
func ParseSML(input, projectName string) (project Project, parseErrors []ParseError)
API ParseSML ... given an SML model, returns a parsed project
func RandomString ¶
RandomString returns a random string of specified length
func RemoveExtraSpaces ¶
RemoveExtraSpaces removes extra spaces in a given string. It trims spaces from left and right ends. It also replaces extra spaces from between words in a string.
Types ¶
type Column ¶
type Column struct { Name string SQL string Label string Format string Type string Description string Transformer string TransformerName string }
Column ...
type CriteriaCombinationTerm ¶
type CriteriaCombinationTerm struct { LogicalOperator string Terms []CriteriaTerm }
type CriteriaSimpleTerm ¶
type CriteriaTerm ¶
type CriteriaTerm struct { // A criteria can either have a combination term // Or a simple term Name string SimpleTerm *CriteriaSimpleTerm CombinationTerm *CriteriaCombinationTerm }
type Dataset ¶
type Dataset struct { Name string Label string TableNames []string Tables map[string]Table Joins []Join }
Dataset ...
type Join ¶
type Join struct { OneTable string // != "" => oneToMany / manyToOne OneColumns []string // != nil => oneToMany / manyToOne OTS []OperatorTableSQL }
Join ...
type OperatorTableSQL ¶
OperatorTableSQL ...
type ParseError ¶
ParseError stores datamodel parse errors and line number
type Project ¶
type Project struct { Name string TableNames []string Tables map[string]Table Datasets map[string]Dataset Schemes map[string]Scheme }
Project ...
type SQLToken ¶
type SQLToken struct { Position int Type SQLTokenType Value string Value2 string }
SQLToken ...
type SQLTokenType ¶
type SQLTokenType int
SQLTokenType ...
const ( NumberSQLToken SQLTokenType = iota StringSQLToken NameSQLToken OpSQLToken ReservedSQLToken UnknownSQLToken )
TokenTypes ...
type StringSet ¶
type StringSet struct {
// contains filtered or unexported fields
}
func ArrayToSet ¶
func NewStringSet ¶
func NewStringSet() StringSet