models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenTypeAccess  = "access"
	TokenTypeRefresh = "refresh"
)
View Source
const (
	RoleUser = "user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Note

type Note struct {
	mgm.DefaultModel `bson:",inline"`
	Author           primitive.ObjectID `json:"author" bson:"author"`
	Title            string             `json:"title" bson:"title"`
	Content          string             `json:"content" bson:"content"`
}

func NewNote

func NewNote(author primitive.ObjectID, title string, content string) *Note

func (*Note) CollectionName

func (model *Note) CollectionName() string

type Token

type Token struct {
	mgm.DefaultModel `bson:",inline"`
	User             primitive.ObjectID `json:"user" bson:"user"`
	Token            string             `json:"token" bson:"token"`
	Type             string             `json:"type" bson:"type"`
	ExpiresAt        time.Time          `json:"expires_at" bson:"expires_at"`
	Blacklisted      bool               `json:"blacklisted" bson:"blacklisted"`
}

func NewToken

func NewToken(userId primitive.ObjectID, tokenString string, tokenType string, expiresAt time.Time) *Token

func (*Token) CollectionName

func (model *Token) CollectionName() string

func (*Token) GetResponseJson

func (model *Token) GetResponseJson() gin.H

type User

type User struct {
	mgm.DefaultModel `bson:",inline"`
	Email            string `json:"email" bson:"email"`
	Password         string `json:"-" bson:"password"`
	Name             string `json:"name" bson:"name"`
	Role             string `json:"role" bson:"role"`
	MailVerified     bool   `json:"mail_verified" bson:"mail_verified"`
}

func NewUser

func NewUser(email string, password string, name string, role string) *User

func (*User) CollectionName

func (model *User) CollectionName() string

type UserClaims

type UserClaims struct {
	jwt.RegisteredClaims
	Email string `json:"email"`
	Type  string `json:"type"`
}

Jump to

Keyboard shortcuts

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