infra

package
v0.0.0-...-e05a182 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEnv

func LoadEnv()

LoadEnv loads configuration from env variables.

func NewCasbin

func NewCasbin(cfg CasbinConfig) (*casbin.Enforcer, error)

func NewPostgres

func NewPostgres(cfg PostgresConfig) (*gorm.DB, error)

NewPostgres creates new connection to postgres and return the connection

func NewRedis

func NewRedis(cfg RedisConfig) (*redis.Client, error)

NewRedis creates new connection to redis and return the connection

Types

type CasbinConfig

type CasbinConfig struct {
	ModelPath  string
	PolicyPath string
}

type Config

type Config struct {
	Mode     string
	Port     string
	Debug    string
	Postgres PostgresConfig
	Redis    RedisConfig
	Casbin   CasbinConfig
}

Config is a general configuration.

var Cfg Config

Cfg is a configuration variable for the app.

type CustomValidator

type CustomValidator struct {
	// contains filtered or unexported fields
}

func NewCustomValidator

func NewCustomValidator() *CustomValidator

func (*CustomValidator) Validate

func (cv *CustomValidator) Validate(i interface{}) error

type PostgresConfig

type PostgresConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
	SSLMode  string
	SSLCert  string
	SSLKey   string
}

PostgresConfig is a configuration for postgres.

type RedisConfig

type RedisConfig struct {
	Host     string
	Port     string
	Password string
	DB       int
}

RedisConfig is a configuration for redis.

Jump to

Keyboard shortcuts

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