utils

package
v0.0.0-...-760f05f Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJSON

func FromJSON(i interface{}, reader io.Reader) error

FromJSON deserializes the object from JSON format string

func ToJSON

func ToJSON(i interface{}, writer io.Writer) error

ToJSON serializes the interface into a JSON format string

Types

type Config

type Config struct {
	Name    string
	Verbose bool
	Server  ConfigServer
	MongoDB ConfigMongo
}

Config is a structure holding all configuration data

func NewConfig

func NewConfig(initConfigPath string) *Config

NewConfig is a factory method to create configuration objects

type ConfigMongo

type ConfigMongo struct {
	Scheme   string
	IP       string
	Port     string
	Database ConfigMongoData
	Timeout  ConfigMongoTimeout
}

ConfigMongo is a structure holding configuration for MongoDB

type ConfigMongoData

type ConfigMongoData struct {
	Name       string
	Collection string
}

ConfigMongoData is a structure holding configuration for MongoDB database

type ConfigMongoTimeout

type ConfigMongoTimeout struct {
	Connection int
	Get        int
	Post       int
	Put        int
	Delete     int
}

ConfigMongoTimeout is a structure holding configuration for MongoDB timeouts

type ConfigServer

type ConfigServer struct {
	IP      string
	Port    string
	TypeDB  string
	Timeout ConfigServerTimeout
}

ConfigServer is a structure holding configuration for server

type ConfigServerTimeout

type ConfigServerTimeout struct {
	Idle  int
	Read  int
	Write int
}

ConfigServerTimeout is a structure holding configuration for server timeouts

type ValidationError

type ValidationError struct {
	validator.FieldError
}

ValidationError wraps validator FieldError to control exposed format

func (ValidationError) Error

func (vError ValidationError) Error() string

Error returns the error string

type ValidationErrors

type ValidationErrors []ValidationError

ValidationErrors is a collection of ValidationError objects

func (ValidationErrors) Errors

func (vErrors ValidationErrors) Errors() []string

Errors returns all error in a string (slice) format

type Validator

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

Validator contains validate rules

func NewValidator

func NewValidator() *Validator

NewValidator is a factory method to create a new Validator type

func (*Validator) Validate

func (v *Validator) Validate(i interface{}) ValidationErrors

Validate is a Validator method used to inspect inputted interface

Jump to

Keyboard shortcuts

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