util

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeneratedGo  = "// Code generated by entlite. DO NOT EDIT.\n\n"
	GeneratedSQL = "-- Code generated by entlite. DO NOT EDIT.\n\n"
	GeneratedMD  = "<!-- Code generated by entlite. DO NOT EDIT. -->\n\n"
)

Variables

This section is empty.

Functions

func Diff

func Diff(expected, actual string) string

Diff styles cmp.Diff in readable format

func FieldsToStr

func FieldsToStr(fields []string) string

func FiltersToStr

func FiltersToStr(filters []schema.QueryFilter) string

func FindModuleInfo

func FindModuleInfo(startDir string) (moduleName string, rootDir string, err error)

FindModuleInfo walks up from startDir and returns the module name with the absolute directory holding go.mod. startDir may be relative or absolute.

func GenEntityGetByIdName

func GenEntityGetByIdName(entity schema.Entity) string

GenEntityGetByIdName returns the name of the query that gets the entity by id.

func GenEntityQueryName

func GenEntityQueryName(entity schema.Entity, queryType schema.QueryType) string

GenEntityQueryName returns the entity's first query of the given type, falling back to the generated name. For the single-per-entity types: create, update, delete.

func GenListMethodName

func GenListMethodName(query schema.Query, entityName string) string

func GenListRpcName

func GenListRpcName(query schema.Query, entityName string) string

func GenQueryName

func GenQueryName(query schema.Query, entityName string) string

GenQueryName returns the entity qualified query name, used as the sqlc query name and the base name of its proto messages. A custom Name() replaces it.

func GenQueryRpcName

func GenQueryRpcName(query schema.Query, entityName string) string

GenQueryRpcName returns the rpc name inside the entity service. A custom Name() replaces it.

func PathToImport

func PathToImport(path string) (string, error)

Types

type BufGenConfig

type BufGenConfig struct {
	// ProtoTypesDir is where the buf.build/protocolbuffers/go plugin writes Go types
	ProtoTypesDir string
}

func GetBufConfigFromYaml

func GetBufConfigFromYaml(bufYamlPath string) (*BufGenConfig, error)

type SQLDialect

type SQLDialect string
const (
	MySQL      SQLDialect = "mysql"
	SQLite     SQLDialect = "sqlite"
	PostgreSQL SQLDialect = "postgresql"
)

type SqlcGenConfig

type SqlcGenConfig struct {
	InputDir string
	Dialect  schema.SQLDialect
}

func GetSqlcConfigFromYaml

func GetSqlcConfigFromYaml(sqlcYamlPath string) (*SqlcGenConfig, error)

Jump to

Keyboard shortcuts

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