response

package
v0.0.0-...-5e83000 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: BSD-2-Clause-Patent Imports: 7 Imported by: 0

Documentation

Overview

Package response contains response data structures and related functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(res http.ResponseWriter, statusCode int, body interface{}, log lax.Logger)

Render renders response with data.

func RenderError

func RenderError(res http.ResponseWriter, err error, log lax.Logger)

RenderError renders response with error by provided error.

func RenderErrorStatus

func RenderErrorStatus(res http.ResponseWriter, statusCode int, message string, log lax.Logger)

RenderErrorStatus renders response with error by provided status code and error message.

Types

type Error

type Error struct {
	Error string `json:"error"`
}

Error response body.

type PasswordStrength

type PasswordStrength struct {
	Strength uint8 `json:"strength"`
}

PasswordStrength contains password strength.

type User

type User struct {
	ID           string     `json:"id,omitempty" format:"uuid"`
	Email        string     `json:"email"`
	Created      *time.Time `json:"created"`
	Updated      *time.Time `json:"updated,omitempty"`
	AuthToken    string     `json:"authToken,omitempty"`
	RefreshToken string     `json:"refreshToken,omitempty"`
}

User contains user data to send out.

func FromDomainUser

func FromDomainUser(user *domain.User) *User

FromDomainUser converts domain user to public user.

Jump to

Keyboard shortcuts

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