Documentation ¶
Index ¶
- func CheckPassword(password string, hashedPassword string) error
- func DateTimeRegExp() *regexp.Regexp
- func HashPassword(password string) (string, error)
- func NewLogger(config Config) *zerolog.Logger
- func ParseDateTime(s string) (time.Time, bool)
- func ParseMobileNumber(s string) (string, bool)
- func RandomEmail() string
- func RandomFloat[T constraints.Float](min, max T) T
- func RandomInt[T constraints.Integer](min, max T) T
- func RandomMobileNumber() string
- func RandomString(n int) string
- func ReverseDBMigration(migrationPath string, dbSource string) error
- func RunDBMigration(migrationPath string, dbSource string) error
- func SetDifference(a, b []string) (diff []string)
- func SetIntersection(a, b []string) (c []string)
- type Config
- type Float4
- type PaginatedList
- type Point
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
func DateTimeRegExp ¶
func HashPassword ¶
HashPassword returns the bcrypt hash of the password
func ParseDateTime ¶
ParseDateTime extracts a valid mobile number from s.
func ParseMobileNumber ¶
ParseMobileNumber extracts a valid mobile number from s.
func RandomFloat ¶
func RandomFloat[T constraints.Float](min, max T) T
RandomFloat generates a random float between min and max
func RandomInt ¶
func RandomInt[T constraints.Integer](min, max T) T
RandomInt generates a random integer between min and max
func RandomMobileNumber ¶
func RandomMobileNumber() string
func RandomString ¶
RandomString generates a random string of length n
func ReverseDBMigration ¶
func RunDBMigration ¶
Types ¶
type Config ¶
type Config struct { Environment string `mapstructure:"ENVIRONMENT"` GinMode string `mapstructure:"GIN_MODE"` DBDriver string `mapstructure:"DB_DRIVER"` DBSource string `mapstructure:"DB_SOURCE"` MigrationPath string `mapstructure:"MIGRATION_PATH"` HTTPServerAddress string `mapstructure:"HTTP_SERVER_ADDRESS"` CookieDomain string `mapstructure:"COOKIE_DOMAIN"` CookiePath string `mapstructure:"COOKIE_PATH"` TokenSymmetricKey string `mapstructure:"TOKEN_SYMMETRIC_KEY"` AccessTokenDuration time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"` RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"` APIBasePath string `mapstructure:"API_BASE_PATH"` SwagAPIBasePath string `mapstructure:"SWAG_API_BASE_PATH"` GlabsAppID string `mapstructure:"GLABS_APP_ID"` GlabsAppSecret string `mapstructure:"GLABS_APP_SECRET"` EnableConsoleLogging bool `mapstructure:"ENABLE_CONSOLE_LOGGING"` EnableFileLogging bool `mapstructure:"ENABLE_FILE_LOGGING"` LogDirectory string `mapstructure:"LOG_DIRECTORY"` LogFilename string `mapstructure:"LOG_FILENAME"` LogMaxSize int `mapstructure:"LOG_MAX_SIZE"` LogMaxBackups int `mapstructure:"LOG_MAX_BACKUPS"` LogMaxAge int `mapstructure:"LOG_MAX_AGE"` CronJobs string `mapstructure:"CRON_JOBS"` }
Config store all configuration of the application. Values are read by viper from a config file or environment variables.
func LoadConfig ¶
LoadConfig read configuration from file or environment variables.
type Float4 ¶
func (Float4) MarshalJSON ¶
MarshalJSON for NullFloat4
func (*Float4) UnmarshalJSON ¶
UnmarshalJSON for NullFloat4
type PaginatedList ¶
type PaginatedList[T any] struct { Page int32 `json:"page"` PerPage int32 `json:"per_page"` TotalPages int32 `json:"total_pages"` NextPage int32 `json:"next_page"` PrevPage int32 `json:"prev_page"` Count int32 `json:"count"` Items []T `json:"items"` }
func NewPaginatedList ¶
func NewPaginatedList[T any](page, limit, count int32, items []T) PaginatedList[T]
Click to show internal directories.
Click to hide internal directories.