sqlUtil

package
Version: v0.0.0-...-e6a098a Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUser

func AddUser(db *sql.DB, name string, pwHash string, permissionLevel uint64, creator *structs.User) (*structs.User, error)

AddUser inserts a user into database, user.id will get set after the insert

func CreateDB

func CreateDB(file string) *sql.DB

CreateDB creates a new sqlite database file

func CreateEncryptedDB

func CreateEncryptedDB(file string, password string) *sql.DB

CreateEncryptedDB creates a new encrypted sqlite database file

func GetUserByCredentials

func GetUserByCredentials(db *sql.DB, username string, pwHash string) (*structs.User, error)

GetUsersByCredentials returns a user from database by his pwHash and username only returns a single user user is unique

func GetUserSimpleByID

func GetUserSimpleByID(db *sql.DB, id uint64) (*structs.UserSimple, error)

GetUserByID returns a user from database by his id

Types

type DBhandler

type DBhandler interface {
	ConfigGet(key string) string
	ConfigSet(key string, val string)
	ConfigRemove(key string)

	UserGet(userID uint64) *structs.UserSimple
	UserSetByID(userID uint64, user *structs.UserSimple)
	UserRemoveByID(userID uint64)

	GroupGet(groupID uint64) *structs.GroupSimple
	GroupSetByID(groupID uint64, group *structs.GroupSimple)
	GroupRemoveByID(groupID uint64)

	CategorieGet(catID uint64) *structs.CategorieSimple
	CategorieSetByID(catID uint64, cat *structs.CategorieSimple)
	CategorieRemoveByID(catID uint64)

	PlaylistGet(playlistID uint64) *structs.PlaylistSimple
	PlaylistSetByID(playlistID uint64, playlist *structs.PlaylistSimple)
	PlaylistRemoveByID(playlistID uint64)

	VideoGet(videoID uint64) *structs.VideoSimple
	VideoSetByID(videoID uint64, video *structs.VideoSimple)
	VideoRemoveByID(videoID uint64)

	PersonalityGet(persID uint64) *structs.PersonalitySimple
	PersonalitySetByID(persID uint64, pers *structs.PersonalitySimple)
	PersonalityRemoveByID(persID uint64)

	RatingsGet(ratingID uint64) *structs.RatingSimple
	RatingsSetByID(ratingID uint64, rating *structs.RatingSimple)
	RatingsRemoveByID(ratingID uint64)

	CommentsGet(commentID uint64) *structs.CommentSimple
	CommentsSetByID(commentID uint64, comment *structs.CommentSimple)
	CommentsRemoveByID(commentID uint64)

	DownloadQGet(qID uint64) *structs.DownloadQSimple
	DownloadQSetByID(qID uint64, q *structs.DownloadQSimple)
	DownloadQRemoveByID(qID uint64)

	MoviesGet(movieID uint64) *structs.MovieSimple
	MoviesSetByID(movieID uint64, movie *structs.MovieSimple)
	MoviesRemoveByID(movieID uint64)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL