crud

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTableColumns

func GetTableColumns(cat *catalog.Catalog, tableName string) []string

GetTableColumns extracts column names from a catalog table.

func SetCustomTemplateDir

func SetCustomTemplateDir(dir string)

SetCustomTemplateDir sets the directory for user-provided CRUD templates.

Types

type ColumnData

type ColumnData struct {
	Name        string
	Placeholder string
}

ColumnData represents a column with its placeholder.

type Generator

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

Generator generates CRUD SQL files from config and catalog.

func New

func New(eng engine.Engine) *Generator

New creates a new CRUD generator for the given engine.

func (*Generator) GenerateTable

func (g *Generator) GenerateTable(
	tableName string,
	tableConfig config.TableConfig,
	defaultCrud *config.CrudDefaultsConfig,
	columns []string,
) ([]byte, error)

GenerateTable generates all CRUD SQL for a single table.

type TemplateData

type TemplateData struct {
	MethodName       string
	OperationType    string
	TableName        string
	PrimaryColumn    string
	Columns          []ColumnData
	Returning        string
	WhereClause      string
	SoftDeleteWhere  bool
	SoftDeleteColumn string
	OrderClause      string
	LimitClause      string
}

TemplateData holds all data needed to render a CRUD SQL template.

Jump to

Keyboard shortcuts

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