util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown      = 1000
	InvalidParse = 1001
	NotFound     = 1002
)

Variables

This section is empty.

Functions

func RunMigrations

func RunMigrations(config MigrationConfig) error

Types

type BusinessError

type BusinessError struct {
	BusinessCode     int               `json:"code"`
	HTTPStatusCode   int               `json:"-"`
	Message          string            `json:"message"`
	ValidationErrors map[string]string `json:"validationErrors,omitempty"`
	Reason           error             `json:"-"`
}

func NewBusinessError

func NewBusinessError(businessCode int, httpStatusCode int, message string, reason error) *BusinessError

func (*BusinessError) Error

func (b *BusinessError) Error() string

type DatabaseDriverType

type DatabaseDriverType string
const (
	PGDriver DatabaseDriverType = "postgres"
)

type Locale

type Locale string
const (
	En     Locale = "en"
	ZhHant Locale = "zh_Hant"
)

type MigrationConfig

type MigrationConfig struct {
	Driver      DatabaseDriverType
	DatabaseURL string
	FileDir     string
}

type ValidationTranslator

type ValidationTranslator struct {
	Validate *validator.Validate
	// contains filtered or unexported fields
}

func NewValidationTranslator

func NewValidationTranslator(ginBindingValidator *validator.Validate, defaultLanguage string) (*ValidationTranslator, error)

func (*ValidationTranslator) Translate

func (v *ValidationTranslator) Translate(language string, err error) (validator.ValidationErrorsTranslations, error)

Jump to

Keyboard shortcuts

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