repository

package
v0.0.0-...-c4064b3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var R = &Repo{}

Functions

func NewRepo

func NewRepo(db *sql.DB)

Types

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

func (*Repo) DeleteNoteByID

func (repo *Repo) DeleteNoteByID(sessId, noteId string) error

DeleteNoteByID deletes a note by its id

func (*Repo) DeleteSession

func (repo *Repo) DeleteSession(sessionID string) error

DeleteSession deletes a Session from database

func (*Repo) DeleteSessions

func (repo *Repo) DeleteSessions(sessionIdList []string) error

DeleteSessions deletes multiple Sessions from database

func (*Repo) DeleteUser

func (repo *Repo) DeleteUser(Id string) error

DeleteUser deletes user from database table users

func (*Repo) GetNoteByID

func (repo *Repo) GetNoteByID(sessId, noteId string) (*models.Note, error)

GetNoteByID returns a note by its id

func (*Repo) GetNotes

func (repo *Repo) GetNotes(userId string) ([]models.Note, error)

GetNotes returns all notes of a user

func (*Repo) InsertNote

func (repo *Repo) InsertNote(userId string, title string, content string) error

InsertNote inserts a new note to the database

func (*Repo) InsertSession

func (repo *Repo) InsertSession(sessionID, userID, IPAddr, userAgent string) error

InsertSession inserts a new Session to database

func (*Repo) InsertUser

func (repo *Repo) InsertUser(username string, email string, hashedPassword string) error

InsertUser user to database table users (username, email ,hashed_password)

func (*Repo) SelectAllSessions

func (repo *Repo) SelectAllSessions() ([]models.Session, error)

func (*Repo) SelectAllSessionsLastEvent

func (repo *Repo) SelectAllSessionsLastEvent() ([]models.Session, error)

SelectAllSessionsLastEvent selects all Sessions from database with just last_event and session_id

func (*Repo) SelectSession

func (repo *Repo) SelectSession(sessionID string) (*models.Session, error)

SelectSession selects a Session from database

func (*Repo) SelectUserByEmail

func (repo *Repo) SelectUserByEmail(email string) (*models.User, error)

SelectUserByEmail selects user from database table users by email

func (*Repo) SelectUserById

func (repo *Repo) SelectUserById(userId string) (*models.User, error)

SelectUserById selects user from database table users by user_id

func (*Repo) SelectUserByUsername

func (repo *Repo) SelectUserByUsername(username string) (*models.User, error)

func (*Repo) UpdateNoteByID

func (repo *Repo) UpdateNoteByID(sessId, noteId, title, content string) error

UpdateNoteByID updates a note by its id

func (*Repo) UpdateSession

func (repo *Repo) UpdateSession(sessionID, IPAddr, userAgent string) error

UpdateSession updates last_event, ip_address and user_agent of a Session

func (*Repo) UpdateUserEmail

func (repo *Repo) UpdateUserEmail(userId, email string) error

UpdateUserEmail updates user email in database table users

func (*Repo) UpdateUserPassword

func (repo *Repo) UpdateUserPassword(userId string, hashedPassword string) error

UpdateUserPassword updates user password in database table users

Jump to

Keyboard shortcuts

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