Documentation ¶
Index ¶
- Variables
- func CacheOneNote(userId primitive.ObjectID, note *models.Note)
- func CheckRedisConnection()
- func CheckUserMail(email string) error
- func CreateNote(userId primitive.ObjectID, title string, content string) (*db.Note, error)
- func CreateToken(user *db.User, tokenType string, expiresAt time.Time) (*db.Token, error)
- func CreateUser(name string, email string, plainPassword string) (*db.User, error)
- func DeleteNote(userId primitive.ObjectID, noteId primitive.ObjectID) error
- func DeleteTokenById(tokenId primitive.ObjectID) error
- func FindUserByEmail(email string) (*db.User, error)
- func FindUserById(userId primitive.ObjectID) (*db.User, error)
- func GenerateAccessTokens(user *db.User) (*db.Token, *db.Token, error)
- func GetNoteById(userId primitive.ObjectID, noteId primitive.ObjectID) (*db.Note, error)
- func GetNoteFromCache(userId primitive.ObjectID, noteId primitive.ObjectID) (*models.Note, error)
- func GetNotes(userId primitive.ObjectID, page int, limit int) ([]db.Note, error)
- func GetRedisCache() *cache.Cache
- func GetRedisDefaultClient() *redis.Client
- func InitMongoDB()
- func LoadConfig()
- func UpdateNote(userId primitive.ObjectID, noteId primitive.ObjectID, ...) error
- func VerifyToken(token string, tokenType string) (*db.Token, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Config *models.EnvConfig
Functions ¶
func CheckRedisConnection ¶
func CheckRedisConnection()
func CheckUserMail ¶
CheckUserMail search user by email, return error if someone uses
func CreateNote ¶
CreateNote create new note record
func CreateToken ¶
CreateToken create a new token record
func CreateUser ¶
CreateUser create a user record
func DeleteNote ¶
DeleteNote delete a note with id
func DeleteTokenById ¶
DeleteTokenById delete token with id
func FindUserByEmail ¶
FindUserByEmail find user by email
func FindUserById ¶
FindUserById find user by id
func GenerateAccessTokens ¶
GenerateAccessTokens generates "access" and "refresh" token for user
func GetNoteById ¶
func GetNoteFromCache ¶
func GetRedisCache ¶
func GetRedisCache() *cache.Cache
func GetRedisDefaultClient ¶
func GetRedisDefaultClient() *redis.Client
func InitMongoDB ¶
func InitMongoDB()
func LoadConfig ¶
func LoadConfig()
func UpdateNote ¶
func UpdateNote(userId primitive.ObjectID, noteId primitive.ObjectID, request *models.NoteRequest) error
UpdateNote updates a note with id
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.