Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDB(cfg *ConfigPG, dbName string)
- func CreateTables(cfg *ConfigPG, tableModels ...any)
- func EnablePostGIS(cfg *ConfigPG)
- func GenQuery(cfg *ConfigPG, models ...any)
- func GenerateModelFromTable(cfg *ConfigPG, tableNames ...string)
- type ConfigPG
- type PostgresDSN
- type Uint64Array
Constants ¶
View Source
const ( Disable sSLMode = "disable" Require sSLMode = "require" VerifyCA sSLMode = "verify-ca" VerifyFull sSLMode = "verify-full" )
View Source
const (
UTC timeZone = "UTC"
)
Variables ¶
View Source
var GormClient *gorm.DB
Functions ¶
func CreateTables ¶
func EnablePostGIS ¶
func EnablePostGIS(cfg *ConfigPG)
EnablePostGIS https://postgis.net/documentation/getting_started/install_windows/enabling_postgis/ note the db must be connected with a specific dbName, usually in DSN only works on postgresql whit PostGIS installed
func GenerateModelFromTable ¶
GenerateModelFromTable empty tables will generate all tables of current database
Types ¶
type ConfigPG ¶
type ConfigPG struct { DSN PostgresDSN LogFileName string DebugMode bool }
func (*ConfigPG) Init ¶
func (c *ConfigPG) Init()
Init if debugMode is true, slog will print log to stdout and do not write to file.
func (*ConfigPG) NewDefaultDB ¶
type PostgresDSN ¶
type PostgresDSN struct { Host string Port int User string Password string DBName string SSLMode sSLMode TimeZone timeZone }
func (*PostgresDSN) GetDSN ¶
func (x *PostgresDSN) GetDSN() string
type Uint64Array ¶
type Uint64Array []uint64
Uint64Array todo replace to pgtype.Array[] https://github.com/jackc/pgx/pull/2020
func (*Uint64Array) Scan ¶
func (a *Uint64Array) Scan(src interface{}) error
Scan implements the sql.Scanner interface.
Click to show internal directories.
Click to hide internal directories.