internal

package
v0.0.0-...-48c47ed Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "version dev" //nolint:gochecknoglobals

Version is injected during the build.

Functions

This section is empty.

Types

type Config

type Config struct {
	DumpInput bool `json:"dump_input,omitempty"`

	EmitDBTags               bool `json:"emit_db_tags,omitempty"`
	EmitExportedQueries      bool `json:"emit_exported_queries,omitempty"`
	EmitResultStructPointers bool `json:"emit_result_struct_pointers,omitempty"`
	EmitParamsStructPointers bool `json:"emit_params_struct_pointers,omitempty"`
	EmitTableNames           bool `json:"emit_table_names,omitempty"`

	OutputDBFileName  string `json:"output_db_file_name,omitempty"`
	OutputFilesSuffix string `json:"output_files_suffix,omitempty"`
	Package           string `json:"package,omitempty"`
}

type FieldMetadata

type FieldMetadata struct {
	Name       string
	ColumnName string
	Type       TypeMetadata
}

func (FieldMetadata) Definition

func (field FieldMetadata) Definition(cfg Config) *j.Statement

func (FieldMetadata) Match

func (field FieldMetadata) Match(other FieldMetadata) bool

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func New

func New(req *plugin.CodeGenRequest) (*Generator, error)

func (*Generator) Generate

func (gen *Generator) Generate() (*plugin.CodeGenResponse, error)

type QueryMetadata

type QueryMetadata struct {
	Query *plugin.Query
	Name  string

	Params           StructMetadata
	ParamsToGenerate bool

	Row           StructMetadata
	RowToGenerate bool
}

type RepositoryMetadata

type RepositoryMetadata struct {
	Name    string
	Queries []QueryMetadata
}

type StructMetadata

type StructMetadata struct {
	Name   string
	Fields []FieldMetadata
}

func (StructMetadata) Definition

func (str StructMetadata) Definition(cfg Config) *j.Statement

func (StructMetadata) Empty

func (str StructMetadata) Empty() bool

func (StructMetadata) Match

func (str StructMetadata) Match(other StructMetadata) bool

func (StructMetadata) Result

func (str StructMetadata) Result(cfg Config) *j.Statement

func (StructMetadata) Var

func (str StructMetadata) Var(name string) *j.Statement

type TypeMetadata

type TypeMetadata struct {
	Path  string
	Name  string
	Array bool
	Ptr   bool
}

func (TypeMetadata) Match

func (t TypeMetadata) Match(other TypeMetadata) bool

func (TypeMetadata) Statement

func (t TypeMetadata) Statement() *j.Statement

Jump to

Keyboard shortcuts

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