core

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const PluginVersion = "0.0.7"

Variables

This section is empty.

Functions

func Annotate added in v0.0.3

func Annotate(typ, annotation string) string

Annotate adds the given annotation to the given Java type. The annotation will always be added to the final element of the type. E.g. - for a package-qualified type: "org.example.@Annotation Foo" - for an array type: "Foo @Annotation []" - for a nested type: "Foo.@Annotation Bar"

func MaybeUnbox added in v0.0.4

func MaybeUnbox(typ string, nullable bool) (string, bool)

MaybeUnbox returns the unboxed form of the given type - if it is not nullable - otherwise does nothing. The function returns a boolean indicating whether the given type was unboxed.

func ResolveImportAndType added in v0.0.2

func ResolveImportAndType(typ string) (string, string, error)

ResolveImportAndType extracts the import required, and type representation of the given java type.

Types

type Config

type Config struct {
	Package                     string   `json:"package"`
	EmitExactTableNames         bool     `json:"emit_exact_table_names"`
	InflectionExcludeTableNames []string `json:"inflection_exclude_table_names"`
	// TODO - implement support for this
	QueryParameterLimit int    `json:"query_parameter_limit"`
	IndentChar          string `json:"indent_char"`
	CharsPerIndentLevel int    `json:"chars_per_indent_level"`
	NullableAnnotation  string `json:"nullable_annotation"`
	NonNullAnnotation   string `json:"non_null_annotation"`
	ExposeConnection    bool   `json:"expose_connection"`
}

type EmbeddedModels added in v0.0.2

type EmbeddedModels map[string][]QueryReturn

type Enum added in v0.0.5

type Enum struct {
	Schema string
	Name   string
	Values []string
}

type Enums added in v0.0.5

type Enums map[string]Enum

Enums is a map of "schema_name.enum_name" to enum value.

type JavaType

type JavaType struct {
	SqlType    string
	Type       string
	IsList     bool
	IsNullable bool
	IsEnum     bool
}

type NullableHelpers added in v0.0.5

type NullableHelpers struct {
	Int     bool
	Long    bool
	Float   bool
	Double  bool
	Boolean bool
	List    bool
}

type Queries

type Queries map[string][]Query

type Query

type Query struct {
	RawCommand   string
	Command      QueryCommand
	Text         string
	RawQueryName string
	MethodName   string
	Args         []QueryArg
	Returns      []QueryReturn
}

type QueryArg

type QueryArg struct {
	Number   int
	Name     string
	JavaType JavaType
}

func (QueryArg) BindStmt

func (q QueryArg) BindStmt(engine string) string

type QueryCommand

type QueryCommand int
const (
	One QueryCommand = iota
	Many
	Exec
	ExecRows
	ExecResult
	CopyFrom
)

func QueryCommandFor

func QueryCommandFor(rawCommand string) (QueryCommand, error)

type QueryReturn

type QueryReturn struct {
	Name          string
	JavaType      JavaType
	EmbeddedModel *string
}

func (QueryReturn) ResultStmt

func (q QueryReturn) ResultStmt(number int) string

Jump to

Keyboard shortcuts

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