godict

package module
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: BSD-2-Clause Imports: 7 Imported by: 0

README

godict

Documentation

Index

Constants

View Source
const (
	ENi = 45
	RUi = 643

	ENLocale = Locale(ENi)
	RULocale = Locale(RUi)
)

Variables

View Source
var (
	ErrDictionaryNotFound = errors.New("dictionary_not_found")
)

Functions

func Marshal

func Marshal(val interface{}) (data []byte, e goerr.IError)

func ParseBody

func ParseBody(r io.ReadCloser, data interface{}) goerr.IError

func ParseBodyReturned added in v2.0.5

func ParseBodyReturned(r io.ReadCloser, data interface{}) (body []byte, e goerr.IError)

func Send

func Send(writer http.ResponseWriter, response *Response)

func SendError

func SendError(writer http.ResponseWriter, e goerr.IError)

func SendJSON

func SendJSON(writer http.ResponseWriter, httpCode int, data interface{})

func SendOk

func SendOk(writer http.ResponseWriter, message interface{}, data interface{},
	pagination interface{})

func Unmarshal

func Unmarshal(data []byte, val interface{}) (e goerr.IError)

func YamlMarshal

func YamlMarshal(val interface{}) (data []byte, e goerr.IError)

func YamlUnmarshal

func YamlUnmarshal(data []byte, val interface{}) (e goerr.IError)

Types

type Dictionary

type Dictionary map[string]map[int]string

func (*Dictionary) DictionaryIdsInterface

func (d *Dictionary) DictionaryIdsInterface(dictionaryName string) (res []interface{}, e goerr.IError)

func (*Dictionary) DictionaryRender

func (d *Dictionary) DictionaryRender(dictionaryName string,
	dictionaryID int) (res DictionaryRender, e goerr.IError)

func (*Dictionary) IsKeyExists

func (d *Dictionary) IsKeyExists(key string) (res bool)

func (*Dictionary) Render

func (d *Dictionary) Render() map[string]*[]DictionaryRender

type DictionaryRender

type DictionaryRender struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type Locale

type Locale int

type Pagination

type Pagination struct {
	Page  int `json:"page,omitempty"`
	Limit int `json:"limit,omitempty"`
	Total int `json:"total,omitempty"`
}

type Response

type Response struct {
	HTTPCode   int         `json:"-"`
	Message    interface{} `json:"message,omitempty"`
	Data       interface{} `json:"data,omitempty"`
	Pagination interface{} `json:"pagination,omitempty"`
	Error      interface{} `json:"error,omitempty"`
}

func Error

func Error(e goerr.IError) *Response

func Ok

func Ok(message interface{}, data interface{}, pagination interface{}) *Response

Jump to

Keyboard shortcuts

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