internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MySQL      = "mysql"
	PostgreSQL = "postgreSQL"
	SQLite     = "sqlite"
)
View Source
const (
	DefaultCfg = "application"
)

Variables

View Source
var (
	RootDir string
	Scope   *do.RootScope
	Cfg     *viper.Viper
)
View Source
var TypeMappings = []lo.Tuple4[GoType, string, string, string]{
	{
		A: "string",
		B: "varchar",
		C: "varchar",
		D: "text",
	},
	{
		A: "bool",
		B: "boolean",
		C: "boolean",
		D: "integer",
	},
	{
		A: "int8",
		B: "tinyint",
		C: "int8",
		D: "integer",
	},

	{
		A: "uint8",
		B: "tinyint unsigned",
		C: "int8",
		D: "integer",
	},

	{
		A: "byte",
		B: "tinyint unsigned",
		C: "int8",
		D: "integer",
	},
	{
		A: "int16",
		B: "smallint",
		C: "smallint",
		D: "integer",
	},

	{
		A: "uint16",
		B: "smallint",
		C: "smallint",
		D: "integer",
	},
	{
		A: "int32",
		B: "int",
		C: "integer",
		D: "integer",
	},
	{
		A: "rune",
		B: "int",
		C: "integer",
		D: "integer",
	},

	{
		A: "uint32",
		B: "int",
		C: "integer",
		D: "integer",
	},
	{
		A: "int64",
		B: "bigint",
		C: "bigint",
		D: "integer",
	},

	{
		A: "uint64",
		B: "bigint",
		C: "bigint",
		D: "integer",
	},
	{
		A: "float32",
		B: "float",
		C: "double precision",
		D: "double precision",
	},
	{
		A: "float64",
		B: "decimal",
		C: "decimal",
		D: "decimal",
	},
	{
		A: "time",
		B: "timestamp",
		C: "timestamp",
		D: "datetime",
	},
}

Functions

func Caller

func Caller() (bool, string)

func Providers

func Providers() []registry.Provider

Types

type Attribute

type Attribute string
const (
	// DBTag struct tag name
	DBTag = "db"
	// AutoUpdateTime attribute tag with `aut` will be set to time.Now() for update
	AutoUpdateTime Attribute = "aut"
	// AutoCreateTime attribute tag with `act` will be set to time.Now() for creation
	AutoCreateTime Attribute = "act"
	// PK identify a column is primary key
	PK Attribute = "pk"
	// Ignore identify this attribute would not map to database column
	Ignore Attribute = "ignore"
	// Name database column name
	Name Attribute = "name"
	// Type database column type
	Type Attribute = "type"
)

type Column

type Column lo.Tuple3[string, string, []string]

func Parse

func Parse(str any) []Column

func (Column) IsPK

func (col Column) IsPK() bool

func (Column) String

func (col Column) String() string

type DBType

type DBType lo.Tuple3[string, []string, []string]

func ParseDBType

func ParseDBType() (DBType, error)

func (DBType) PrimaryStr

func (p DBType) PrimaryStr() []string

type GoType

type GoType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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