database

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEmail

func CheckEmail(client *mongo.Client, req *proto.CheckEmailRequest) error

func DeleteSession

func DeleteSession(client *mongo.Client, req *proto.DeleteSessionRequest) error

func FlushSessions

func FlushSessions(client *mongo.Client, req *proto.FlushSessionsRequest) error

func Init

func Init(client *mongo.Client) error

func ValidateEmail

func ValidateEmail(client *mongo.Client, req *proto.ValidateEmailRequest) error

Types

type Session

type Session struct {
	Token     string `bson:"token"`
	CreatedAt string `bson:"createdAt"`
}

type User

type User struct {
	Name            string    `bson:"name"`
	Email           string    `bson:"email"`
	Uuid            string    `bson:"uuid"`
	PasswordHash    string    `bson:"hash"`
	ValidationToken string    `bson:"validation_token"`
	Sessions        []Session `bson:"sessions"`
}

func CreateSession

func CreateSession(client *mongo.Client, req *proto.CreateSessionRequest) (*User, string, error)

func CreateUser

func CreateUser(client *mongo.Client, req *proto.CreateUserRequest) (*User, string, error)

func GetUser

func GetUser(client *mongo.Client, req *proto.GetUserRequest) (*User, error)

func UpdateUser

func UpdateUser(client *mongo.Client, req *proto.UpdateUserRequest) (*User, error)

Jump to

Keyboard shortcuts

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