Documentation ¶
Index ¶
- type Comment
- type DB
- type Link
- type Postgres
- func (pg *Postgres) CheckOwner(userId int, stashId int) (bool, error)
- func (pg *Postgres) CheckStashPublic(stashId int) (bool, error)
- func (pg *Postgres) GetComments(stashId int) ([]*Comment, error)
- func (pg *Postgres) GetLinks(stashId int) ([]*Link, error)
- func (pg *Postgres) GetPublicStashes() ([]*Stash, error)
- func (pg *Postgres) GetPublicStashesUser(userId int) ([]*Stash, error)
- func (pg *Postgres) GetStashDetailed(stashId int) (*StashDetail, error)
- func (pg *Postgres) GetUserByEmail(email string) (*User, error)
- func (pg *Postgres) GetUserProfile(userId int) (*UserDetail, error)
- func (pg *Postgres) GetUserStashes(userId int) ([]*Stash, error)
- func (pg *Postgres) UpsertUser(username string, name string, email string, pictue string) error
- type Stash
- type StashDetail
- type User
- type UserDetail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { // Stash operations GetPublicStashes() ([]*Stash, error) GetPublicStashesUser(userId int) ([]*Stash, error) GetUserStashes(userId int) ([]*Stash, error) GetStashDetailed(stashId int) (*StashDetail, error) CheckOwner(userId int, stashId int) (bool, error) CheckStashPublic(stashId int) (bool, error) //User operations GetUserByEmail(email string) (*User, error) GetUserProfile(userId int) (*UserDetail, error) UpsertUser(username string, name string, email string, pictue string) error // Comment operations GetComments(stashId int) ([]*Comment, error) //Link operations GetLinks(stashId int) ([]*Link, error) }
func NewPostgresDB ¶
Takes in a connection string and returns a DB interface, which is a pointer to the Postgres Database
type Postgres ¶
func (*Postgres) GetPublicStashes ¶
func (*Postgres) GetPublicStashesUser ¶
func (*Postgres) GetStashDetailed ¶
func (pg *Postgres) GetStashDetailed(stashId int) (*StashDetail, error)
func (*Postgres) GetUserProfile ¶
func (pg *Postgres) GetUserProfile(userId int) (*UserDetail, error)
Returns User by email
type StashDetail ¶
Click to show internal directories.
Click to hide internal directories.