internal

package
v0.0.0-...-2e9bc18 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectImports

func DetectImports(columns []Column, isExternal bool) []string

func DetectQueryImports

func DetectQueryImports(tables []Table, queries []Query) []string

func FindCompatible

func FindCompatible(tables []Table) func(tableName string, cols []Column) string

func Generate

func Generate()

func GenerateDBFile

func GenerateDBFile(schema Schema, config SQLCConfig, t *template.Template, outDir string)

func GenerateEnumFile

func GenerateEnumFile(schema Schema, t *template.Template, outDir string)

func GenerateModelFiles

func GenerateModelFiles(schema Schema, t *template.Template, outDir string)

func GenerateStoreFile

func GenerateStoreFile(schema Schema, config SQLCConfig, t *template.Template, outDir string)

func GetSprintfFormatFromKey

func GetSprintfFormatFromKey(query *Query, from string) string

func IsBulkQuery

func IsBulkQuery(query *Query) bool

func Singular

func Singular(s string) string

func ToCamelCase

func ToCamelCase(name string) string

func ToGoCase

func ToGoCase(name string) string

func ToGoType

func ToGoType(col Column, isExternal bool) string

func ToPascalCase

func ToPascalCase(name string) string

Types

type CacheOptions

type CacheOptions struct {
	Allow     bool
	Kind      string
	Key       string
	KeyColumn *Column
	Table     string
	VersionBy *VersionByOptions
	Fields    []string
	TTL       int64
}

type Catalog

type Catalog struct {
	Schemas []Schema `json:"schemas"`
}

type Column

type Column struct {
	Name    string `json:"name"`
	NotNull bool   `json:"not_null"`
	IsArray bool   `json:"is_array"`
	Table   struct {
		Name string `json:"name"`
	} `json:"table"`
	Type struct {
		Name string `json:"name"`
	} `json:"type"`
}

func FilterColumnsByKeys

func FilterColumnsByKeys(columns []Column, exclude []string) []Column

func GetArrays

func GetArrays(query *Query) []Column

type Enum

type Enum struct {
	Name string   `json:"name"`
	Vals []string `json:"vals"`
}

type Param

type Param struct {
	Number int    `json:"number"`
	Column Column `json:"column"`
}

func GetParamsOrdered

func GetParamsOrdered(query *Query, order []string) []Param

type Query

type Query struct {
	Text     string   `json:"text"`
	Name     string   `json:"name"`
	Cmd      string   `json:"cmd"`
	Columns  []Column `json:"columns"`
	Params   []Param  `json:"params"`
	Comments []string `json:"comments"`
	FileName string   `json:"filename"`
}

type QueryOptions

type QueryOptions struct {
	Cache   CacheOptions
	Order   []string
	Exclude []string
}

func GetQueryOptions

func GetQueryOptions(query *Query) *QueryOptions

type SQLCConfig

type SQLCConfig struct {
	Catalog Catalog `json:"catalog"`
	Queries []Query `json:"queries"`
}

func LoadSQLCConfig

func LoadSQLCConfig(path string) SQLCConfig

type Schema

type Schema struct {
	Name   string  `json:"name"`
	Tables []Table `json:"tables"`
	Enums  []Enum  `json:"enums"`
}

func GetPublicSchema

func GetPublicSchema(config SQLCConfig) Schema

type Table

type Table struct {
	Rel struct {
		Name string `json:"name"`
	} `json:"rel"`

	Columns []Column `json:"columns"`
}

type Templates

type Templates struct {
	DB    *template.Template
	Model *template.Template
	Types *template.Template
	Store *template.Template
}

func ParseTemplates

func ParseTemplates(schema Schema, templateDir string) *Templates

type VersionByOptions

type VersionByOptions struct {
	Column *Column
	Table  string
}

Jump to

Keyboard shortcuts

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