gen

package
v0.0.0-...-3eb00e4 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PACKAGE_NAME         = "jet-model-gen"
	JET_PASSWORD_ENV_VAR = "JET_MODEL_GEN_DB_PASSWORD"
)

Variables

This section is empty.

Functions

func GenerateGoModels

func GenerateGoModels(db *sql.DB, params GoModelParams) error

func GenerateTsModels

func GenerateTsModels(goModelDir, tsDir, tsFile string) error

Types

type DBDriver

type DBDriver string
var (
	PostgresDriver DBDriver = "postgres"
	SqliteDriver   DBDriver = "sqlite"
	MysqlDriver    DBDriver = "mysql"
)

type GoModelParams

type GoModelParams struct {
	Driver                 DBDriver
	BaseJetDir             string
	Schema                 string
	NewTimestampName       string
	NewBigintName          string
	NewUUIDName            string
	NewTimestampPath       string
	NewBigintPath          string
	NewUUIDPath            string
	ExcludedTableFieldTags map[string]struct{}
}

type JetModelGenCmd

type JetModelGenCmd struct {
	RootCmd RootParams `mapstructure:"root_cmd"`
}

type LanguageType

type LanguageType string
var (
	GoLanguageType LanguageType = "go"
	TsLanguageType LanguageType = "ts"
)

type RootParams

type RootParams struct {
	// Database fields
	DbSchema     string   `mapstructure:"db_schema"`
	DbDriver     DBDriver `mapstructure:"db_driver"`
	DbUser       string   `mapstructure:"db_user"`
	DbPassword   string   `mapstructure:"db_password"`
	DbHost       string   `mapstructure:"db_host"`
	DbPort       int      `mapstructure:"db_port"`
	DbName       string   `mapstructure:"db_name"`
	DbSslMode    string   `mapstructure:"db_ssl_mode"`
	DbSslKey     string   `mapstructure:"db_ssl_mode"`
	DbSslRootCrt string   `mapstructure:"db_ssl_root_crt"`
	DbSslCrt     string   `mapstructure:"db_ssl_crt"`

	// Directory/file fields
	GoDir        string `mapstructure:"go_dir"`
	TsDir        string `mapstructure:"ts_dir"`
	TsFile       string `mapstructure:"ts_file"`
	RemoveGenDir bool   `mapstructure:"remove_gen_dir"`

	// Data type fields
	NewTimestampName string `mapstructure:"new_timestamp_name"`
	NewBigintName    string `mapstructure:"new_bigint_name"`
	NewUUIDName      string `mapstructure:"new_uuid_name"`

	NewTimestampPath string `mapstructure:"new_timestamp_path"`
	NewBigintPath    string `mapstructure:"new_bigint_path"`
	NewUUIDPath      string `mapstructure:"new_uuid_path"`

	ExcludedTableFieldTags []string `mapstructure:"excluded_table_field_tags"`
}

Jump to

Keyboard shortcuts

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