modelgen

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRelation

func AddRelation(modelFile string, relations []RelationInfo, modelName string) error

AddRelation menambahkan relasi ke file model

func CreateEntityFile added in v1.0.5

func CreateEntityFile(filename, modelName string, fields []FieldInfo, force bool) error

func CreateMigrationFile added in v1.0.5

func CreateMigrationFile(modelName, migrationsFolder, moduleName string) error

func CreateModel added in v1.0.5

func CreateModel(filename, modelName string, fields []FieldInfo, force bool) error

func CreateRepositoryFile added in v1.0.5

func CreateRepositoryFile(filename, modelName, moduleName string) error

func CreateServiceFile added in v1.0.5

func CreateServiceFile(filename, modelName, moduleName string) error

func GenerateDBConfig added in v1.0.3

func GenerateDBConfig(baseFolder, dbType string) error

GenerateDBConfig membuat file configs/db.go untuk berbagai DB

func GenerateModelEntity

func GenerateModelEntity(modelName string, fields []FieldInfo, baseFolder string) error

GenerateModelEntity membuat GORM-ready model, entity, dan file migrasi

func UpdateMasterMigration added in v1.0.5

func UpdateMasterMigration(migrationsFolder, modelName string) error

Types

type FieldInfo

type FieldInfo struct {
	Name string
	Type string
	Tag  string
}

type GoField added in v1.0.5

type GoField struct {
	GoType  string
	GormTag string
}

func MapJSONType added in v1.0.5

func MapJSONType(fieldName, t string) GoField

func MapType added in v1.0.5

func MapType(t string) GoField

type RelationInfo

type RelationInfo struct {
	FieldName string
	Target    string
	Type      RelationType
}

type RelationType

type RelationType string
const (
	One2Many  RelationType = "one2many"
	Many2Many RelationType = "many2many"
)

Jump to

Keyboard shortcuts

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