model

package
v0.0.0-...-590dba6 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Login

type Login struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"Password" validate:"required"`
}

Login request model

func (*Login) FromJSON

func (l *Login) FromJSON(r io.Reader) error

FromJSON load data from json

func (*Login) Validate

func (l *Login) Validate() error

Validate json input body

type Profile

type Profile struct {
	ID             string `json:"id"`
	UserID         string `json:"-"`
	ProfilePicture string `json:"profilePicture"`
}

Profile model object

type Response

type Response struct {
	Status  int         `json:"status"`
	Message string      `json:"message"`
	Content interface{} `json:"content"`
}

Response is the http json response schema

func NewResponse

func NewResponse(status int, message string, content interface{}) *Response

NewResponse object

type Token

type Token struct {
	Role        []string `json:"role"`
	Username    string   `json:"username"`
	TokenString string   `json:"accessToken"`
}

Token responce

type User

type User struct {
	ID       primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Username string             `json:"username" bson:"username,omitempty" validate:"required"`
	Password string             `json:"password" bson:"password,omitempty" validate:"required,gte=8"`
	Email    string             `json:"email" bson:"email,omitempty" validate:"required"`
	Profile  Profile            `json:"profile" bson:"-"`
}

User models object

func (*User) FromJSON

func (u *User) FromJSON(r io.Reader) error

FromJSON load data from json

func (*User) SetPassword

func (u *User) SetPassword(hs string)

SetPassword for update password value

func (*User) Validate

func (u *User) Validate() error

Validate json input body

Jump to

Keyboard shortcuts

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