models

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	Role     string `json:"role"`
	Level    int    `json:"level"`
	jwt.RegisteredClaims
}

Claims

type Credentials

type Credentials struct {
	Username string `json:"username,omitempty"`
	Email    string `json:"email,omitempty"`
	Password string `json:"password"`
}

Create a struct that models the structure of a user in the request body

type Error

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

Error is used as the Response Body

type Message

type Message struct {
	Code    string `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

Message is response body for success messages

type ServiceError

type ServiceError struct {
	Kind    string `json:"kind,omitempty"`
	Code    string `json:"code,omitempty"`
	Param   string `json:"param,omitempty"`
	Message string `json:"message,omitempty"`
}

ServiceError has fields for Service errors. All fields with no data will be omitted

type Token

type Token struct {
	Token string `json:"token"`
}

Token is a struct that will be encoded to a JWT

type User

type User struct {
	ID         uint         `json:"id,omitempty" gorm:"primary_key,autoIncrement,not null"`
	FirstName  *string      `json:"first_name,omitempty" gorm:"not null"`
	MiddleName *string      `json:"middle_name,omitempty"`
	LastName   *string      `json:"last_name,omitempty" gorm:"not null"`
	Username   *string      `json:"username"  gorm:"unique,not null"`
	Email      *string      `json:"email" gorm:"unique"`
	DOB        *string      `json:"dob,omitempty" gorm:""`
	Password   *string      `json:"password,omitempty" gorm:"not null"`
	Role       *string      `json:"role,omitempty" gorm:"not null"`
	Level      *int         `json:"level,omitempty" gorm:"not null"`
	CreatedAt  time.Time    `json:"created_at" gorm:"not null"`
	UpdatedAt  time.Time    `json:"updated_at" gorm:"not null"`
	DeletedAt  sql.NullTime `json:"deleted_at" gorm:"index,not null"`
}

User is a user of the application

Jump to

Keyboard shortcuts

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