db

package
v0.0.0-...-35b7764 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateUser

func ActivateUser(id string) error

activate user, use when verify

func Close

func Close()

close connections with database and distributed cache

func CreateRepo

func CreateRepo(ownerName, repoName string, visibility bool) error

register on database a repo with given author, name and visibility

func CreateUser

func CreateUser(id, name, email, password, picture string) error

use for register, it creates a new user in DB using assumed values

func DeleteUserSession

func DeleteUserSession(deviceId string) error

func EmailIsRegistered

func EmailIsRegistered(email string) bool

check if a user with given email exists

func GetRepoByOwnerAndName

func GetRepoByOwnerAndName(owner, name string) (models.Repo, error)

owner username and repo name to retrieve a unique repo

func GetReposByOwner

func GetReposByOwner(ownerName string, includePrivate bool) ([]models.Repo, error)

get all repos who has been created by given username

func GetUserByName

func GetUserByName(username string) (models.User, error)

use to retrieve data of user

func GetUserByNameOrEmail

func GetUserByNameOrEmail(userOrMail string) (models.User, error)

use for login, give as param a value that could be username or email of the searched user

func GetUserSession

func GetUserSession(deviceId string) (models.User, error)

function to use on any logged-in route, to get context of the logged user data.

func NameIsRegistered

func NameIsRegistered(name string) bool

check if a username exists

func Open

func Open()

start connections with database and distributed cache

func SetUserSession

func SetUserSession(deviceId string, user models.User) error

function to use on login. Is to store the user data to persist across session

func UpdateRepo

func UpdateRepo(data models.Repo) error

update repo data in db, it only replaces

func UpdateUser

func UpdateUser(data models.User) error

replace picture, bio, displayname, amountrepositores, and password with given values

Types

This section is empty.

Jump to

Keyboard shortcuts

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