model

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzedQuery

type AnalyzedQuery struct {
	Query             Query
	ResultStructName  string
	ShouldEmitResult  bool
	Fields            []ResultField
	EmbeddedTables    []EmbeddedTable
	NullableTables    map[string]bool
	NullableAliases   map[string]bool
	GeneratedJSONSeen map[string]bool
}

AnalyzedQuery contains the type information required for code generation.

type Column

type Column struct {
	Name     string
	SQLType  string
	Nullable bool
}

Column describes one schema column.

type Dialect

type Dialect uint8

Dialect identifies a supported SQL dialect.

const (
	DialectSQLite Dialect = iota
	DialectPostgres
)

Supported SQL dialects.

type EmbeddedTable

type EmbeddedTable struct {
	TableName  string
	StructName string
	IsNullable bool
	TableAlias string
}

EmbeddedTable describes an application row type embedded in a result.

type GeneratedJSONField

type GeneratedJSONField struct {
	JSONName   string
	FieldName  string
	GoType     string
	Nullable   bool
	FromTable  string
	FromColumn string
	TableAlias string
}

GeneratedJSONField describes a field nested in generated JSON result types.

type Hashtag

type Hashtag struct {
	Name     string
	Type     string
	IsSlice  bool
	Explicit bool
	Index    int
}

Hashtag describes one dynamic SQL fragment.

type Import

type Import struct {
	Path   string
	Alias  string
	Schema bool
}

Import describes a Go import.

type Param

type Param struct {
	Name     string
	Type     string
	Explicit bool
	Index    int
}

Param describes one parameterized SQL value.

type Query

type Query struct {
	Name            string
	Description     string
	Deprecated      string
	Warnings        []string
	RawSQL          string
	SQL             string
	Params          []Param
	Hashtags        []Hashtag
	HashtagSequence []string
	SourceSQL       string
}

Query is a parsed named query.

type QueryFile

type QueryFile struct {
	Imports []Import
	Queries []Query
}

QueryFile contains the imports and named queries in a queryc file.

type ResultField

type ResultField struct {
	Name                string
	DBName              string
	GoType              string
	Nullable            bool
	Serialization       string
	ExplicitType        string
	IsExpression        bool
	Skip                bool
	FromTable           string
	FromColumn          string
	TableAlias          string
	GeneratedStructName string
	GeneratedStructKind string
	GeneratedFields     []GeneratedJSONField
}

ResultField describes one analyzed result column.

type Schema

type Schema struct {
	Tables map[string]Table
}

Schema contains tables keyed by SQL name.

type Table

type Table struct {
	Name         string
	Columns      map[string]Column
	PrimaryKeys  []string
	AutoFields   []string
	HasUpdatedAt bool
	Aliases      []string
}

Table describes a parsed schema table.

Jump to

Keyboard shortcuts

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