casting

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	/*FORMFE : Formato de fecha para los archivo YYYYMMDD*/
	FORMFE = "%d%02d%02d"
)

Variables

This section is empty.

Functions

func AsignarPtr

func AsignarPtr(a interface{}) interface{}

AsignarPtr : asigna la data despues de referencias en punteros muchas veces

func BytetoStr

func BytetoStr(str []byte) string

BytetoStr : Convierte un array byte a string

func BytetoStrHex

func BytetoStrHex(str []byte) string

BytetoStrHex : Convierte un array byte a string

func CleanStringJson added in v1.0.9

func CleanStringJson(data string) string

CleanStringJson : limpia un string json de caracteres especiales

func DecodeBase64

func DecodeBase64(s string) string

DecodeBase64 : convierte un string base64 a string normal

func EncodeBase64

func EncodeBase64(s string) string

EncodeBase64 : convierte a base64 un string

func Float64ToStr

func Float64ToStr(val float64) string

Float64ToStr : Convierte un valor float64 a string.

func Int32ToStr

func Int32ToStr(val int32) string

Int32ToStr : Convierte un int32 a string.

func Int64ToStr

func Int64ToStr(val int64) string

Int64ToStr : Convierte un int64 a string.

func IntToStr

func IntToStr(val int) string

IntToStr : Convierte un int a string.

func JSONStrObj added in v1.0.7

func JSONStrObj(data string) ([]map[string]interface{}, error)

JSONtoObj : convierte un string a map

func JSONtoObj

func JSONtoObj(d JSON) ([]map[string]interface{}, error)

JSONtoObj : convierte objetos JSON en map.

func JsonStructMapData

func JsonStructMapData(data interface{}) (map[string]interface{}, error)

JsonStructMapData : convierte un struct con tag json a map interface

func MapKeys

func MapKeys(data *map[interface{}]interface{}) []interface{}

MapKeys : Conviert un map a interface o datos dinamicos.

func MapStrKeys

func MapStrKeys(data *map[string]interface{}) []string

MapStrKeys : Convierte un map a arreglo de string

func NewTicker

func NewTicker(ft, tp string) (*time.Ticker, error)

NewTicker : Crea un nuevo ticker por medio de formatos hr -> horas min -> minutos

func ParseJSON

func ParseJSON(d JSON, v interface{}) error

ParseJSON : Captura el JSON con cualquier data

func PrintMap

func PrintMap(format string, data map[string]interface{}) string

PrintMap : formatea un string con un mapa de datos este mapa de datos debe colocar las variables con {var1} para ser reemplazado por el dato

func RoundFloat64

func RoundFloat64(valor float64, dec int) float64

RoundFloat64 : redondea un

func SliceStrToStr

func SliceStrToStr(strs []string, separador string) string

SliceStrToStr : convierte un array de strings a un string con separador

func StrToFloat64

func StrToFloat64(val string) (float64, error)

StrToFloat64 : Convierte un valor string a float64.

func StrToInt32

func StrToInt32(val string) (int32, error)

StrToInt32 : Convierte un string a int32

func StrToInt64

func StrToInt64(val string) (int64, error)

StrToInt64 : Convierte un string a int64

func StringToDate

func StringToDate(s string) (time.Time, error)

StringToDate : convierte un string a un time

func StrtoByte

func StrtoByte(str string) []byte

StrtoByte : Convierte un string a array byte

func StrtoByteHex

func StrtoByteHex(str string) []byte

StrtoByteHex : Convierte un string a array byte

func StructToMap

func StructToMap(i interface{}) (valores url.Values)

StructToMap : Convierte un struct a map[string]

func TimetoStr

func TimetoStr(dia time.Time) string

TimetoStr : Convierte un time al string con el formato YYYYMMDD que esta en constante.

func ToBoolean

func ToBoolean(data interface{}) bool

ToBoolean : convierte un interface a bool

func ToDateStr

func ToDateStr(t time.Time) string

ToDateStr : envia en formato largo un datetime YYYY-MM-DDTHH:MM:SS

func ToDateStrSingle

func ToDateStrSingle(t time.Time) string

ToDateStrSingle : envia en formato largo un datetime YYYY-MM-DD

func ToFloat

func ToFloat(i interface{}) float32

ToFloat : convierte un interface a float32

func ToFloat64

func ToFloat64(i interface{}) float64

ToFloat64 : convierte un interface a float64

func ToInt

func ToInt(i interface{}) int

ToInt : convierte un interface a int

func ToInt8

func ToInt8(i interface{}) int8

ToInt8 : convierte un interface a int8

func ToInt16

func ToInt16(i interface{}) int16

ToInt16 : convierte un interface a int16

func ToInt32

func ToInt32(i interface{}) int32

ToInt32 : convierte un interface a int32

func ToInt64

func ToInt64(i interface{}) int64

ToInt64 : convierte un interface a int64

func ToJsonMapStr added in v1.0.7

func ToJsonMapStr(jsonStr string) (map[string]string, error)

ToJsonMapStr : convierte un string a map

func ToMapInterface

func ToMapInterface(i interface{}) (map[string]interface{}, error)

ToMapInterface : convierte cualquier data en map [string]interface{}

func ToString

func ToString(i interface{}) string

ToString : convierte una data interface a un string cualquiera

func ToTime

func ToTime(data interface{}) (tim time.Time, err error)

ToTime : Convierte un interface a time

Types

type Component

type Component string

Component : crea componentes literal

func (*Component) Add

func (p *Component) Add(data ...Component) *Component

Add : agrega componentes a los template

func (*Component) Body

func (p *Component) Body(vladd string) *Component

Body : carga el cuerto del literal component

func (*Component) Byte

func (p *Component) Byte() []byte

Byte : convierte a byte el template

func (*Component) HTML

func (p *Component) HTML(styles string) *Component

HTML : genera el compnente con una base de html

func (*Component) Map

func (p *Component) Map(key string, data ...Component) *Component

Map : hace un ciclo de datos en una variable especifica {var}

func (*Component) Print

func (p *Component) Print(key string, data interface{}) *Component

Print : reemplaza un key por data

func (*Component) PrintMap

func (p *Component) PrintMap(data map[string]interface{}) *Component

PrintMap : genera un string literal html con datos mapeados

func (*Component) String

func (p *Component) String() string

String : convierte en string

type Date

type Date struct {
	time.Time
}

Date : formato Time especial con parseo los xml y json de manera que el formato puede variar

func NewDateNow

func NewDateNow() Date

NewDateNow : crear un tipo date con la fecha actual

func (*Date) Equals

func (p *Date) Equals(data Date) int

Equals : Valida dos date a -> b

1 -> mayor a

0 -> igual b

-1 -> menor a

func (*Date) HrTime

func (p *Date) HrTime() HrTime

HrTime : crea una instancia de hrtime

func (*Date) ToString

func (p *Date) ToString() string

ToString : lo convierte un date en string

func (*Date) UnmarshalJSON

func (p *Date) UnmarshalJSON(input []byte) error

UnmarshalJSON : fomateo especial a json para los tipo Time en golang

func (*Date) UnmarshalXML

func (p *Date) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML : fomateo especial a xml para los tipo Time en golang

type Float64XML

type Float64XML float64

Float64XML : tipo que repara el error de los xml en los millones

func (Float64XML) MarshalXMLAttr

func (f Float64XML) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr : tramforma el xml

type HrTime

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

HrTime : valida las horas en un time

func NewHrTime

func NewHrTime(hr, min int) (HrTime, error)

NewHrTime : crea un time

func NewHrTimeDate

func NewHrTimeDate(data Date) (HrTime, error)

NewHrTimeDate : crea un time con un tipo date

func NewHrTimeStr

func NewHrTimeStr(fr string) (HrTime, error)

NewHrTimeStr : crea un time con formato de hora 24hr ejemplo 24:00

func (*HrTime) EqualDate

func (p *HrTime) EqualDate(date Date) bool

EqualDate : Valida si un hrtime es identico a un date

func (*HrTime) EqualNow

func (p *HrTime) EqualNow() bool

EqualNow : Valida si un hrtime es identico a un date de la hora actual

func (*HrTime) GetHr

func (p *HrTime) GetHr() (hr, min int)

GetHr : extrae un tipo time

func (*HrTime) SetHr

func (p *HrTime) SetHr(hr, min int) error

SetHr : setea un tipo time

func (*HrTime) SetHrTime

func (p *HrTime) SetHrTime(hr, min int) error

SetHrTime : setea un tipo time

func (*HrTime) Valid

func (p *HrTime) Valid() error

Valid : valida la estructura

type JSON

type JSON []byte

JSON : Contiene datos JSON de muchos objetos.

func NewJSON

func NewJSON(v interface{}) (JSON, error)

NewJSON : Crea un JSON con cualquier data

func ObjtoJSON

func ObjtoJSON(Encabezado []string, filas [][]interface{}) (JSON, error)

ObjtoJSON : convierte maps en objetos JSON .

Jump to

Keyboard shortcuts

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