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 SetDifference(a, b []string) (diff []string)
- func SetIntersection(a, b []string) (c []string)
- func ToFloat4(f *float32) pgtype.Float4
- func ToInt4(i *int32) pgtype.Int4
- func ToPgDate(s string) pgtype.Date
- func ToPgText(s string) pgtype.Text
- type Config
- type Date
- type DockerPostgres
- type Float4
- type PaginatedList
- type Point
- type Province
- type Region
- type RegionNumerical
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
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"` LogLevel string `mapstructure:"LOG_LEVEL"` 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 Date ¶
Date represents a date-only value
func (Date) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*Date) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface
type DockerPostgres ¶
type DockerPostgres struct { Source string Conn *pgxpool.Pool // contains filtered or unexported fields }
func NewDockerPostgres ¶
func NewDockerPostgres() *DockerPostgres
func (*DockerPostgres) Close ¶
func (pg *DockerPostgres) Close()
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]
type Point ¶
type Point struct {
*geom.Point
}
type RegionNumerical ¶
type RegionNumerical string
func (*RegionNumerical) Fake ¶
func (c *RegionNumerical) Fake(f *gofakeit.Faker) (any, error)