auth_service_rest

package
v0.0.0-...-194ba8f Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App _

func New

func New(router *mux.Router, db *sqlx.DB, jwtSecret string, cachePool *redis.Pool) (app App, err error)

New _

type AuthSchema

type AuthSchema struct {
	Email    string `json:"email" valid:"required~Email is required"`
	Password string `json:"password" valid:"length(4|16)~Password length should not be less than 4"`
}

AuthSchema defines structure of auth information

type DataPayload

type DataPayload struct {
	Success bool                   `json:"success"`
	Data    map[string]interface{} `json:"data"`
}

DataPayload structure for error responses

type JwtClaims

type JwtClaims struct {
	ID        string    `json:"id"`
	Username  string    `json:"username"`
	Email     string    `json:"email"`
	Role      string    `json:"role"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	ExpiresAt time.Time `json:"expirationTime"`
	jwt.StandardClaims
}

type MalformedRequest

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

MalformedRequest _

func (*MalformedRequest) Error

func (mr *MalformedRequest) Error() string

type Middleware

type Middleware func(http.HandlerFunc) http.HandlerFunc

Middleware _

type NullString

type NullString struct {
	sql.NullString
}

func (*NullString) MarshalJSON

func (value *NullString) MarshalJSON() ([]byte, error)

override MarshalJSON method for custom type NullString

func (*NullString) UnmarshalJSON

func (value *NullString) UnmarshalJSON(b []byte) error

override UnmarshalJSON method for custom type NullString

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route defines a structure for routes

type User

type User struct {
	ID        string     `json:"id"`
	Username  NullString `json:"username"`
	Email     string     `json:"email"`
	Password  string     `json:"password"`
	Role      string     `json:"role"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
}

type UserReturnData

type UserReturnData struct {
	ID        string    `json:"id"`
	Username  string    `json:"username"`
	Email     string    `json:"email"`
	Role      string    `json:"role"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	Token     string    `json:"token"`
}

UserReturnData defines structure of user information to return

type UserSchema

type UserSchema struct {
	ID        string    `json:"id"`
	Username  string    `json:"username"`
	Email     string    `json:"email"`
	Password  string    `json:"password"`
	Role      string    `json:"role"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

UserSchema defines structure of user information

type UsernameUpdateSchema

type UsernameUpdateSchema struct {
	Username string `json:"username" valid:"required~Username is blank"`
}

UsernameUpdateSchema defines structure of user information

Jump to

Keyboard shortcuts

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