core

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoubleSlashComment

func DoubleSlashComment(f string) string

func Imports

func Imports(filename string) [][]string

func KtFormat

func KtFormat(s string) string

func LowerTitle

func LowerTitle(f string) string

func Offset

func Offset(v int) int

Types

type Config

type Config struct {
	Package                     string   `json:"package"`
	EmitExactTableNames         bool     `json:"emit_exact_table_names"`
	InflectionExcludeTableNames []string `json:"inflection_exclude_table_names"`
}

type Constant

type Constant struct {
	Name  string
	Type  string
	Value string
}

type Enum

type Enum struct {
	Name      string
	Comment   string
	Constants []Constant
}

func BuildEnums

func BuildEnums(req *plugin.GenerateRequest) []Enum

type Field

type Field struct {
	ID      int
	Name    string
	Type    ktType
	Comment string
}

type Importer

type Importer struct {
	Settings    *plugin.Settings
	DataClasses []Struct
	Enums       []Enum
	Queries     []Query
}
var DefaultImporter *Importer

func (*Importer) Imports

func (i *Importer) Imports(filename string) [][]string

type KtTmplCtx

type KtTmplCtx struct {
	Q           string
	Package     string
	Enums       []Enum
	DataClasses []Struct
	Queries     []Query
	Settings    *plugin.Settings
	SqlcVersion string

	// TODO: Race conditions
	SourceName string

	EmitJSONTags        bool
	EmitPreparedQueries bool
	EmitInterface       bool
}

type Params

type Params struct {
	Struct *Struct
	// contains filtered or unexported fields
}

func (Params) Args

func (v Params) Args() string

func (Params) Bindings

func (v Params) Bindings() string

type Query

type Query struct {
	ClassName    string
	Cmd          string
	Comments     []string
	MethodName   string
	FieldName    string
	ConstantName string
	SQL          string
	SourceName   string
	Ret          QueryValue
	Arg          Params
}

A struct used to generate methods and fields on the Queries struct

func BuildQueries

func BuildQueries(req *plugin.GenerateRequest, structs []Struct) ([]Query, error)

type QueryValue

type QueryValue struct {
	Emit   bool
	Name   string
	Struct *Struct
	Typ    ktType
}

func (QueryValue) EmitStruct

func (v QueryValue) EmitStruct() bool

func (QueryValue) IsStruct

func (v QueryValue) IsStruct() bool

func (QueryValue) ResultSet

func (v QueryValue) ResultSet() string

func (QueryValue) Type

func (v QueryValue) Type() string

type Struct

type Struct struct {
	Table   plugin.Identifier
	Name    string
	Fields  []Field
	Comment string
}

func BuildDataClasses

func BuildDataClasses(conf Config, req *plugin.GenerateRequest) []Struct

Jump to

Keyboard shortcuts

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