utils

package
v0.0.0-...-47d141a Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorResponse

func ErrorResponse(w http.ResponseWriter, code int, err error)

func GetJwt

func GetJwt(signerClaims Credentials) (tokenString string, expireTime time.Time, err error)

func RefreshJwt

func RefreshJwt(w http.ResponseWriter, r *http.Request)

func ResponseJson

func ResponseJson(w http.ResponseWriter, code int, payload interface{})

Types

type Claims

type Claims struct {
	Creds Credentials
	jwt.RegisteredClaims
}

type Credentials

type Credentials struct {
	Email string
	Name  string
}

type DBUserResponse

type DBUserResponse struct {
	ID        uuid.UUID      `json:"id"`
	FirstName string         `json:"first_name"`
	LastName  string         `json:"last_name"`
	Email     string         `json:"email"`
	Bio       sql.NullString `json:"bio"`
}

func MapLoginUser

func MapLoginUser(dbUser database.User) DBUserResponse

type DbUserFullSchema

type DbUserFullSchema struct {
	ID        uuid.UUID      `json:"id"`
	FirstName string         `json:"first_name"`
	LastName  string         `json:"last_name"`
	Email     string         `json:"email"`
	Bio       sql.NullString `json:"bio"`
	Isadmin   bool           `json:"is_admin"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
}

func MapRegisteredUser

func MapRegisteredUser(dbUser database.User) DbUserFullSchema

Jump to

Keyboard shortcuts

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