util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 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"
)

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)

startDir accepts both relative and absolute path rootDir is absolute path for go.mod

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 name of the entity's first query of the given type, falling back to the generated name when the entity has no such query. Meant for the single-per-entity query 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 name of a query, used both as the sqlc query name and as the base name of its proto messages. A custom Name() from the schema replaces the generated name.

func GenQueryRpcName

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

GenQueryRpcName returns the rpc name of a query inside its entity service. A custom Name() from the schema replaces the generated name.

func PathToImport

func PathToImport(path string) (string, error)

Types

type BufGenConfig

type BufGenConfig struct {
	// ProtoTypesDir is the output directory for the generated Go proto types
	// (the buf.build/protocolbuffers/go plugin).
	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