utils

package
v0.0.0-...-a894b33 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const UNKNOWN = "UNKNOWN"

* Store the default name

Variables

This section is empty.

Functions

func ReturnJson

func ReturnJson(w http.ResponseWriter, statusCode int, data interface{})

* Provide a support method to return json

func ReturnJsonError

func ReturnJsonError(w http.ResponseWriter, statusCode int, err error)

* Provide a support method to return json

func ReturnJsonMessage

func ReturnJsonMessage(w http.ResponseWriter, statusCode int, message string)

* Provide a support method to return json

func ReturnJsonNoEscape

func ReturnJsonNoEscape(w http.ResponseWriter, statusCode int, data interface{})

* Provide a support method to return json

func ReturnJsonStatus

func ReturnJsonStatus(w http.ResponseWriter, statusCode int, status bool, message string)

* Provide a support method to return json

Types

type Base64File

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

func NewBase64File

func NewBase64File(data string) (*Base64File, error)

* Decode the base 64 string

func NewBase64FileFromForm

func NewBase64FileFromForm(file multipart.File, fileInfo *multipart.FileHeader) (*Base64File, error)

* Decode the base 64 string

func (*Base64File) GetDataBytes

func (file *Base64File) GetDataBytes() []byte

func (*Base64File) GetDataReader

func (file *Base64File) GetDataReader() *bytes.Reader

func (*Base64File) GetEncodedData

func (file *Base64File) GetEncodedData() string

func (*Base64File) GetMime

func (file *Base64File) GetMime() string

func (*Base64File) GetName

func (file *Base64File) GetName() string

type DynamicJson

type DynamicJson map[string]interface{}

func NewDynamicJson

func NewDynamicJson() DynamicJson

func WrapDynamicJson

func WrapDynamicJson(input interface{}) DynamicJson

func (DynamicJson) AppendArray

func (dyJs DynamicJson) AppendArray(name string, value interface{}) DynamicJson

* Return array

func (DynamicJson) GetArray

func (dyJs DynamicJson) GetArray(name string) *[]interface{}

func (DynamicJson) GetNumber

func (dyJs DynamicJson) GetNumber(name string) float64

* Returns the existing or new child object

func (DynamicJson) GetObject

func (dyJs DynamicJson) GetObject(name string) DynamicJson

* Returns the existing or new child object

func (DynamicJson) GetValue

func (dyJs DynamicJson) GetValue(name string) string

* Returns the existing or new child object

func (DynamicJson) SetValue

func (dyJs DynamicJson) SetValue(name string, value interface{}) DynamicJson

* Returns the existing or new child object

type JSONstring

type JSONstring string

func (JSONstring) MarshalJSON

func (str JSONstring) MarshalJSON() ([]byte, error)

struct to JSON

func (*JSONstring) UnmarshalJSON

func (str *JSONstring) UnmarshalJSON(data []byte) error

JSON to aliased string object

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

NullTime represents a time.Time that may be null. NullTime implements the sql.Scanner interface so it can be used as a scan destination, similar to sql.NullString.

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Unit

type Unit struct {
	//Store the name
	Name string

	//Store the symbol
	Symbol string
	// contains filtered or unexported fields
}

func GetLengthUnit

func GetLengthUnit(unitName string) Unit

* Function to look up string from

func (*Unit) GetFactorSI

func (unit *Unit) GetFactorSI() float64

* Convert to SI from the other unit

func (*Unit) ToSI

func (unit *Unit) ToSI(input float64) float64

* Convert to SI from the other unit

Jump to

Keyboard shortcuts

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