30 lines
838 B
Go
30 lines
838 B
Go
|
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)
|
||
|
}
|