Nashboard/storage/storage.go

30 lines
838 B
Go
Raw Permalink Normal View History

2022-12-11 02:05:03 +03:00
package storage
import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type Storage interface {
// Users
CreateUser(*User) (primitive.ObjectID, error)
GetUser(*bson.D) (*User, error)
GetUsers(*bson.D) ([]*User, error)
GetUserByID(primitive.ObjectID) (*User, error)
UpdateUser(*User) error
DeleteUser(primitive.ObjectID) error
// Sessions
CreateSession(*Session) (primitive.ObjectID, error)
GetSessionByToken(string) (*Session, error)
GetUserSessions(*User) ([]*Session, error)
DeleteSession(primitive.ObjectID) error
// Bookmarks
CreateBookmark(*Bookmark) (primitive.ObjectID, error)
GetBookmarkByID(primitive.ObjectID) (*Bookmark, error)
GetBookmark(*bson.D) (*Bookmark, error)
GetBookmarks(*bson.D) ([]*Bookmark, error)
GetUserBookmarks(*User, *bson.D) ([]*Bookmark, error)
}