utils

package
v0.0.0-...-40b04e4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanRut

func CleanRut(rut *string)

func GenerateJWT

func GenerateJWT(id uint64, email string, username string) (tokenString string, err error)

func GenerateWhereFilter

func GenerateWhereFilter(filters []string, queryParams url.Values) (map[string]interface{}, error)

func GetLimitOffset

func GetLimitOffset(queryParams url.Values) (int, int, error)

func InsertNth

func InsertNth(s string, n int, symbol rune) string

func IsValidRut

func IsValidRut(rut string) (bool, error)

func JSONErrorOutput

func JSONErrorOutput(writer http.ResponseWriter, status int, msg string)

func PrettyRut

func PrettyRut(rut *string)

func Reverse

func Reverse(s string) string

Types

type Date

type Date time.Time // 2006-01-02

func (Date) Format

func (date Date) Format(s string) string

func (*Date) GobDecode

func (date *Date) GobDecode(b []byte) error

func (Date) GobEncode

func (date Date) GobEncode() ([]byte, error)

func (Date) GormDataType

func (date Date) GormDataType() string

func (Date) MarshalJSON

func (date Date) MarshalJSON() ([]byte, error)

func (*Date) Scan

func (date *Date) Scan(value interface{}) (err error)

func (*Date) UnmarshalJSON

func (date *Date) UnmarshalJSON(b []byte) error

func (Date) Value

func (date Date) Value() (driver.Value, error)

type DateTime

type DateTime time.Time // 2006-01-02 15:04:05

func (DateTime) Format

func (dateTime DateTime) Format(s string) string

func (*DateTime) GobDecode

func (date *DateTime) GobDecode(b []byte) error

func (DateTime) GobEncode

func (date DateTime) GobEncode() ([]byte, error)

func (DateTime) GormDataType

func (date DateTime) GormDataType() string

func (DateTime) MarshalJSON

func (dateTime DateTime) MarshalJSON() ([]byte, error)

func (*DateTime) Scan

func (date *DateTime) Scan(value interface{}) (err error)

func (*DateTime) UnmarshalJSON

func (dateTime *DateTime) UnmarshalJSON(b []byte) error

func (DateTime) Value

func (date DateTime) Value() (driver.Value, error)

type ErrorMessage

type ErrorMessage struct {
	ErrorMessage string `json:"error_message"`
}

type JWTClaim

type JWTClaim struct {
	Id       uint64 `json:"id"`
	Username string `json:"username"`
	Email    string `json:"email"`
	jwt.RegisteredClaims
}

func ValidateToken

func ValidateToken(signedToken string) (claims *JWTClaim, err error)

type RutType

type RutType int8
const (
	Run RutType = iota
	Rut
)

func GetRutType

func GetRutType(rut string) (RutType, error)

func (RutType) String

func (r RutType) String() string

Jump to

Keyboard shortcuts

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