pscale

package
v0.0.0-...-92a07c5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArticlesDB

type ArticlesDB struct {
	DB *sqlx.DB
}

func NewArticlesDB

func NewArticlesDB(dsn string) (*ArticlesDB, error)

NewPscaleDB returns a connection interface for the application to connect to the planetscale database.

func (*ArticlesDB) Delete

func (aDB *ArticlesDB) Delete(ids string) error

func (*ArticlesDB) Find

func (aDB *ArticlesDB) Find(terms string) (*core.ArticleSeries, error)

Find implements a mysql fulltext search of the articles table

func (*ArticlesDB) Get

func (aDB *ArticlesDB) Get(offset, limit int) (*core.ArticleSeries, error)

Get retrieves a slice of 10 articles from the planetscale database with limit and offset in the query.

func (*ArticlesDB) GetArticle

func (aDB *ArticlesDB) GetArticle(id int) (*core.Article, error)

func (*ArticlesDB) GetQuestion

func (aDB *ArticlesDB) GetQuestion(qn string) (string, error)

func (*ArticlesDB) Store

func (aDB *ArticlesDB) Store(data *core.ArticleSeries) error

Store stores a slice of articles sent from the front end admin dashboard via the articles service.

func (*ArticlesDB) Update

func (aDB *ArticlesDB) Update(data *core.ArticleSeries) error

type AuthDB

type AuthDB struct {
	DB *sqlx.DB
}

func NewAuthDB

func NewAuthDB(dsn string) (*AuthDB, error)

func (*AuthDB) ClearTokens

func (ps *AuthDB) ClearTokens(userID int) error

func (*AuthDB) DeleteToken

func (ps *AuthDB) DeleteToken(token string) error

func (*AuthDB) GetToken

func (ps *AuthDB) GetToken(tokenHash string) (*core.Token, error)

func (*AuthDB) InsertToken

func (ps *AuthDB) InsertToken(token *core.Token) error

func (*AuthDB) RefreshToken

func (ps *AuthDB) RefreshToken(token *core.Token) error

type LongsDB

type LongsDB struct {
	DB *sqlx.DB
}

func NewLongsDB

func NewLongsDB(dsn string) (*LongsDB, error)

NewPscaleDB returns a connection interface for the application to connect to the planetscale database.

func (*LongsDB) Delete

func (lDB *LongsDB) Delete(ids string) error

func (*LongsDB) Get

func (lDB *LongsDB) Get(topic string) (*core.LongSeries, error)

func (*LongsDB) GetAll

func (lDB *LongsDB) GetAll() (*core.LongSeries, error)

func (*LongsDB) GetTopics

func (lDB *LongsDB) GetTopics() (*core.LongTopics, error)

func (*LongsDB) Store

func (lDB *LongsDB) Store(data *core.LongPayload) error

func (*LongsDB) Update

func (lDB *LongsDB) Update(data *core.Long) error

type PostsDB

type PostsDB struct {
	DB *sqlx.DB
}

func NewPostsDB

func NewPostsDB(dsn string) (*PostsDB, error)

NewPscaleDB returns a connection interface for the application to connect to the planetscale database.

func (*PostsDB) AddPost

func (pDB *PostsDB) AddPost(post *core.Post) error

func (*PostsDB) DeletePost

func (pDB *PostsDB) DeletePost(postID int) error

func (*PostsDB) GetAllPublicPosts

func (pDB *PostsDB) GetAllPublicPosts() (*core.Posts, error)

func (*PostsDB) GetLikes

func (pDB *PostsDB) GetLikes(id int, userOrPost string) ([]int, error)

func (*PostsDB) GetPost

func (pDB *PostsDB) GetPost(id int) (*core.Post, error)

func (*PostsDB) GetPosts

func (pDB *PostsDB) GetPosts(userIDs []int, public bool) (*core.Posts, error)

func (*PostsDB) UpdatePost

func (pDB *PostsDB) UpdatePost(postID int, post *core.Post) error

type SocialsDB

type SocialsDB struct {
	DB *sqlx.DB
}

func NewSocialsDB

func NewSocialsDB(dsn string) (*SocialsDB, error)

NewPscaleDB returns a connection interface for the application to connect to the planetscale database.

func (*SocialsDB) Follow

func (sDB *SocialsDB) Follow(userID, toFollow int) error

func (*SocialsDB) GetFollowedBy

func (sDB *SocialsDB) GetFollowedBy(userID int) ([]int, error)

func (*SocialsDB) GetFollowing

func (sDB *SocialsDB) GetFollowing(userID int) ([]int, error)

func (*SocialsDB) Like

func (sDB *SocialsDB) Like(userID, postID int) error

func (*SocialsDB) UnFollow

func (sDB *SocialsDB) UnFollow(userID, toUnFollow int) error

func (*SocialsDB) Unlike

func (sDB *SocialsDB) Unlike(userID, postID int) error

type StatsDB

type StatsDB struct {
	DB *sqlx.DB
}

func NewStatsDB

func NewStatsDB(dsn string) (*StatsDB, error)

NewPscaleDB returns a connection interface for the application to connect to the planetscale database.

func (*StatsDB) GetStats

func (sDB *StatsDB) GetStats() (*core.Stats, error)

type UsersDB

type UsersDB struct {
	DB *sqlx.DB
}

func NewUsersDB

func NewUsersDB(dsn string) (*UsersDB, error)

func (*UsersDB) DeleteUser

func (uDB *UsersDB) DeleteUser(id int) error

func (*UsersDB) GetUser

func (uDB *UsersDB) GetUser(field string, value any) (*core.User, error)

func (*UsersDB) InsertUsers

func (uDB *UsersDB) InsertUsers(users *[]core.User) error

func (*UsersDB) UpdateClasses

func (uDB *UsersDB) UpdateClasses(users *[]core.User) error

func (*UsersDB) UpdateUser

func (uDB *UsersDB) UpdateUser(newUser *core.User) error

Jump to

Keyboard shortcuts

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