Documentation ¶
Index ¶
- Variables
- func NewRepo(db *sql.DB)
- type Repo
- func (repo *Repo) DeleteNoteByID(sessId, noteId string) error
- func (repo *Repo) DeleteSession(sessionID string) error
- func (repo *Repo) DeleteSessions(sessionIdList []string) error
- func (repo *Repo) DeleteUser(Id string) error
- func (repo *Repo) GetNoteByID(sessId, noteId string) (*models.Note, error)
- func (repo *Repo) GetNotes(userId string) ([]models.Note, error)
- func (repo *Repo) InsertNote(userId string, title string, content string) error
- func (repo *Repo) InsertSession(sessionID, userID, IPAddr, userAgent string) error
- func (repo *Repo) InsertUser(username string, email string, hashedPassword string) error
- func (repo *Repo) SelectAllSessions() ([]models.Session, error)
- func (repo *Repo) SelectAllSessionsLastEvent() ([]models.Session, error)
- func (repo *Repo) SelectSession(sessionID string) (*models.Session, error)
- func (repo *Repo) SelectUserByEmail(email string) (*models.User, error)
- func (repo *Repo) SelectUserById(userId string) (*models.User, error)
- func (repo *Repo) SelectUserByUsername(username string) (*models.User, error)
- func (repo *Repo) UpdateNoteByID(sessId, noteId, title, content string) error
- func (repo *Repo) UpdateSession(sessionID, IPAddr, userAgent string) error
- func (repo *Repo) UpdateUserEmail(userId, email string) error
- func (repo *Repo) UpdateUserPassword(userId string, hashedPassword string) error
Constants ¶
This section is empty.
Variables ¶
var R = &Repo{}
Functions ¶
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func (*Repo) DeleteNoteByID ¶
DeleteNoteByID deletes a note by its id
func (*Repo) DeleteSession ¶
DeleteSession deletes a Session from database
func (*Repo) DeleteSessions ¶
DeleteSessions deletes multiple Sessions from database
func (*Repo) DeleteUser ¶
DeleteUser deletes user from database table users
func (*Repo) GetNoteByID ¶
GetNoteByID returns a note by its id
func (*Repo) InsertNote ¶
InsertNote inserts a new note to the database
func (*Repo) InsertSession ¶
InsertSession inserts a new Session to database
func (*Repo) InsertUser ¶
InsertUser user to database table users (username, email ,hashed_password)
func (*Repo) SelectAllSessionsLastEvent ¶
SelectAllSessionsLastEvent selects all Sessions from database with just last_event and session_id
func (*Repo) SelectSession ¶
SelectSession selects a Session from database
func (*Repo) SelectUserByEmail ¶
SelectUserByEmail selects user from database table users by email
func (*Repo) SelectUserById ¶
SelectUserById selects user from database table users by user_id
func (*Repo) SelectUserByUsername ¶
func (*Repo) UpdateNoteByID ¶
UpdateNoteByID updates a note by its id
func (*Repo) UpdateSession ¶
UpdateSession updates last_event, ip_address and user_agent of a Session
func (*Repo) UpdateUserEmail ¶
UpdateUserEmail updates user email in database table users