domain

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DecimalPkgPath   = "github.com/quagmt/udecimal"
	UUIDPkgPath      = "github.com/google/uuid"
	GoptionPkgPath   = "github.com/manicar2093/goption"
	GormPagerPkgPath = "github.com/manicar2093/gormpager"
	GormPkgPath      = "gorm.io/gorm"
	EchoPkgPath      = "github.com/labstack/echo/v4"
	TimePkgPath      = "time"
)
View Source
const (
	JsonTag         Tag = "json"
	MapstructureTag     = "mapstructure"
	ParamTag            = "param"
	GormUuidTag         = "gorm|default:gen_random_uuid()"
)

Variables

View Source
var (
	InternalPackagePath             Path = "internal"
	PkgPackagePath                  Path = "pkg"
	PrismaPackagePath               Path = "prisma"
	CmdPackagePath                  Path = "cmd"
	GithubPackagePath               Path = ".github"
	PkgGeneratorsPackagePath             = Path(path.Join(string(PkgPackagePath), "generators"))
	PkgConfigPackagePath                 = Path(path.Join(string(PkgPackagePath), "config"))
	PkgVersioningPackagePath             = Path(path.Join(string(PkgPackagePath), "versioning"))
	CmdApiPackagePath                    = Path(path.Join(string(CmdPackagePath), "api"))
	CmdApiControllersPackagePath         = Path(path.Join(string(CmdPackagePath), "api", "controllers"))
	PrismaSchemaPackagePath              = Path(path.Join(string(PrismaPackagePath), "schema"))
	InternalDomainModelsPackagePath      = Path(path.Join(string(InternalPackagePath), "domain", "models"))
	GithubWorkflowsPackagePath           = Path(path.Join(string(GithubPackagePath), "workflows"))

	CoreConnectionsPkg CorePackage = "connections"
	CoreCommonReqPkg   CorePackage = "commonreq"
)

Functions

func GenerateCorePackage

func GenerateCorePackage(info ModuleInfo) string

func GetCorePackage

func GetCorePackage(info ModuleInfo, pkg CorePackage) string

func GetGoModName

func GetGoModName() (string, error)

func GetPackageQualifier

func GetPackageQualifier(moduleName string, path Path, model string) *jen.Statement

func OptionalQualifier

func OptionalQualifier() jen.Code

func ParseArgs

func ParseArgs(args []string, moduleName string, isPkUuid bool) (GenerateModelInput, []ParsingErrorDetail, bool)

func QualifiersByType

func QualifiersByType(t string) *jen.Statement

func Tags

func Tags(attribute Attribute, validations Validations, tags ...Tag) map[string]string

Types

type Attribute

type Attribute struct {
	TransformedText
	Type       string
	IsOptional bool
}

type CorePackage

type CorePackage string

type GenerateModelInput

type GenerateModelInput struct {
	TransformedText
	PackageEntityName string
	ModuleInfo        ModuleInfo
	IdAttribute       Attribute
	Attributes        []Attribute
}

type ModuleInfo

type ModuleInfo struct {
	Name string
}

type ParsingErrorDetail

type ParsingErrorDetail struct {
	Input string
	Err   string
	Index int
}

func (ParsingErrorDetail) String

func (p ParsingErrorDetail) String() string

type Path

type Path string

type Pkg

type Pkg string
var (
	ModelsPkg     Pkg = "models"
	GeneratorsPkg Pkg = "generators"
)

type SupportedType

type SupportedType string
var (
	TypeInt     SupportedType = "int"
	TypeInt8    SupportedType = "int8"
	TypeInt16   SupportedType = "int16"
	TypeInt32   SupportedType = "int32"
	TypeInt64   SupportedType = "int64"
	TypeFloat32 SupportedType = "float32"
	TypeFloat64 SupportedType = "float64"
	TypeString  SupportedType = "string"
	TypeBool    SupportedType = "bool"
	TypeTime    SupportedType = "time"
	TypeDecimal SupportedType = "decimal"
	TypeUuid    SupportedType = "uuid"

	ValidTypesMap = map[SupportedType]bool{
		TypeInt:     true,
		TypeInt8:    true,
		TypeInt16:   true,
		TypeInt32:   true,
		TypeInt64:   true,
		TypeFloat32: true,
		TypeFloat64: true,
		TypeString:  true,
		TypeBool:    true,
		TypeTime:    true,
		TypeDecimal: true,
		TypeUuid:    true,
	}
)

type Tag

type Tag string

type TransformedText

type TransformedText struct {
	SnakeCase        string
	PascalCase       string
	CamelCase        string
	LowerNoSpaceCase string
}

type Validations

type Validations struct {
	Required bool
}

Jump to

Keyboard shortcuts

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