models

package
v0.0.0-...-9b2c065 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SECRET_PEPPER = "locum-secret-pepper"

Variables

This section is empty.

Functions

This section is empty.

Types

type DbCloser

type DbCloser interface {
	CloseDB() error
}

type FriendRequest

type FriendRequest struct {
	UserId    string    `json:"userId"`
	Timestamp time.Time `json:"timestamp"`
}

type GeoTime

type GeoTime struct {
	Latitude  float32   `json:"latitude"`
	Longitude float32   `json:"longitude"`
	Timestamp time.Time `json:"timestamp"`
}

type User

type User struct {
	Id            string    `json:"id"`
	Email         string    `json:"email"`
	FullName      string    `json:"fullName"`
	LastLoginTime time.Time `json:"lastLoginTime"`
	CreationTime  time.Time `json:"creationTime"`
}

type UserDB

type UserDB interface {
	ByID(userId string) (User, error)
	Query(queryString string) ([]User, error)

	// Methods for altering contents
	Create(user User) error
	Update(user User) error
	Delete(userId string) error
	DbCloser
}

func NewUserDB

func NewUserDB(db *badger.DB) UserDB

type UserFriends

type UserFriends struct {
	UserId         string          `json:"id"`
	FriendIds      []string        `json:"friendIds"`
	FriendRequests []FriendRequest `json:"friendRequests"`
}

type UserFriendsDB

type UserFriendsDB interface {
	ByUserID(userId string) (UserFriends, error)

	// Methods for altering contents
	Create(userFriends UserFriends) error
	Append(userFriends UserFriends) error

	RemoveFriend(userId, friendId string) error
	AddFriend(userId, friendId string) error

	RemoveFriendRequest(userId, friendId string) error
	AddFriendRequest(userId string, friendRequest FriendRequest) error

	Update(userFriends UserFriends) error
	Delete(userId string) error
	DbCloser
}

func NewUserFriendsDB

func NewUserFriendsDB(db *badger.DB) UserFriendsDB

type UserLocation

type UserLocation struct {
	UserId   string    `json:"userId"`
	GeoTimes []GeoTime `json:"geoTime"`
}

type UserLocationDB

type UserLocationDB interface {
	ByUserID(userId string) (UserLocation, error)
	LatestGeoTimeByUserID(userId string) (GeoTime, error)

	// Methods for altering UserLocations
	Create(userLocation UserLocation) error
	Append(userLocation UserLocation) error
	Update(userLocation UserLocation) error
	Delete(userId string) error
	DbCloser
}

func NewUserLocationDB

func NewUserLocationDB(db *badger.DB) UserLocationDB

type UserToken

type UserToken struct {
	UserId       string    `json:"userId"`
	Token        string    `json:"token"`
	CreationTime time.Time `json:"creationTime"`
}

func NewUserToken

func NewUserToken(userId string) UserToken

type UserTokenDB

type UserTokenDB interface {
	ByToken(token string) (UserToken, error)
	// Methods for altering contents
	Create(userToken UserToken) error
	Update(userToken UserToken) error
	Delete(userId string) error
	DbCloser
}

func NewUserTokenDB

func NewUserTokenDB(db *badger.DB) UserTokenDB

Jump to

Keyboard shortcuts

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