model

package
v3.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Prefix, Suffix string

Functions

func WriteGo added in v3.1.3

func WriteGo(units *codegen.Units, m Model, w DualWriter)

Types

type Config

type Config struct {
	MainType       string
	Plural, Pkg    string
	MarshalTextRep enum.Representation
	MarshalJSONRep enum.Representation
	StoreRep       enum.Representation
	IgnoreCase     bool
	Unsnake        bool
	Lenient        bool
}

Config contains the model parameters obtained from command line options (either directly or computed).

type DualWriter

type DualWriter interface {
	io.Writer
	io.StringWriter
}

type Imports

type Imports struct {
	Database bool
	Strings  bool
}

type Model

type Model struct {
	Config
	LcType, BaseType string
	Version          string
	Values           Values
	Case             transform.Case
	AliasTable       string
	Imports          collection.StringSet
	Extra            map[string]interface{}
}

Model holds the information available during template evaluation.

func (Model) AllItemsSlice

func (m Model) AllItemsSlice() string

func (Model) Asymmetric

func (m Model) Asymmetric() bool

func (Model) BaseKind

func (m Model) BaseKind() types.BasicKind

func (Model) BuildUnits added in v3.1.3

func (m Model) BuildUnits() *codegen.Units

func (Model) CheckBadPrefixSuffix

func (m Model) CheckBadPrefixSuffix() error

func (Model) CheckBadTags

func (m Model) CheckBadTags() error

func (Model) FnMap

func (m Model) FnMap() template.FuncMap

func (Model) HasJSONTags

func (m Model) HasJSONTags() bool

func (Model) HasSQLTags

func (m Model) HasSQLTags() bool

func (Model) HasTextTags

func (m Model) HasTextTags() bool

func (Model) Indexes

func (m Model) Indexes() string

func (Model) InputCase

func (m Model) InputCase() transform.Case

func (Model) InputJSONValues

func (m Model) InputJSONValues() []string

func (Model) InputSQLValues

func (m Model) InputSQLValues() []string

func (Model) InputTextValues

func (m Model) InputTextValues() []string

func (Model) IsFloat

func (m Model) IsFloat() bool

func (Model) JSONIndexes

func (m Model) JSONIndexes() string

func (Model) OutputJSONValues

func (m Model) OutputJSONValues() []string

func (Model) OutputSQLValues

func (m Model) OutputSQLValues() []string

func (Model) OutputTextValues

func (m Model) OutputTextValues() []string

func (Model) Placeholder

func (m Model) Placeholder() string

func (Model) SQLIndexes

func (m Model) SQLIndexes() string

func (Model) SelectImports

func (m Model) SelectImports() Model

func (Model) TextIndexes

func (m Model) TextIndexes() string

func (Model) TransformedInputValues

func (m Model) TransformedInputValues() []string

func (Model) TransformedOutputValues

func (m Model) TransformedOutputValues() []string

func (Model) ValuesJoined

func (m Model) ValuesJoined(from int, separator string) string

func (Model) ValuesWithWrapping

func (m Model) ValuesWithWrapping(nTabs int) string

type Value

type Value struct {
	Identifier      string
	Shortened       string
	Text, JSON, SQL string
}

type Values

type Values []Value

func ValuesOf

func ValuesOf(ss ...string) Values

func (Values) Append

func (vs Values) Append(s string, tag reflect.StructTag) Values

func (Values) Identifiers

func (vs Values) Identifiers() []string

func (Values) Shortened

func (vs Values) Shortened() []string

Jump to

Keyboard shortcuts

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