utils

package
v0.0.0-...-246f41c Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: BSD-3-Clause Imports: 11 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 string, rut string, email string) (tokenString string, err 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

func ValidateToken

func ValidateToken(signedToken string) (err error)

Types

type AnyTime

type AnyTime struct{}

func (AnyTime) Match

func (a AnyTime) Match(v driver.Value) bool

type Date

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

func DateNow

func DateNow() Date

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) String

func (date Date) String() string

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 DateTimeNow

func DateTimeNow() DateTime

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) String

func (dateTime DateTime) String() string

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:"ErrorMessage"`
}

type JWTClaim

type JWTClaim struct {
	ID    string `json:"id"`
	Rut   string `json:"rut"`
	Email string `json:"email"`
	jwt.RegisteredClaims
}

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