Documentation
¶
Index ¶
- type ChangePasswordParams
- type CreatePostParams
- type CreateSessionParams
- type CreateUserParams
- type DBTX
- type DeletePostParams
- type GetPostParams
- type GetPostRow
- type LikePostParams
- type LikedPost
- type LikedPostsRow
- type NextPostsParams
- type NextPostsRow
- type Post
- type PrivateUser
- type PublicUser
- type Queries
- func (q *Queries) ChangePassword(ctx context.Context, arg ChangePasswordParams) error
- func (q *Queries) CreatePost(ctx context.Context, arg CreatePostParams) error
- func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) error
- func (q *Queries) DeletePost(ctx context.Context, arg DeletePostParams) (int64, error)
- func (q *Queries) DeleteSession(ctx context.Context, token string) error
- func (q *Queries) GetPost(ctx context.Context, arg GetPostParams) (GetPostRow, error)
- func (q *Queries) LikePost(ctx context.Context, arg LikePostParams) error
- func (q *Queries) LikedPosts(ctx context.Context, username string) ([]LikedPostsRow, error)
- func (q *Queries) NextPosts(ctx context.Context, arg NextPostsParams) ([]NextPostsRow, error)
- func (q *Queries) PostLikeCount(ctx context.Context, postID int64) (int64, error)
- func (q *Queries) Self(ctx context.Context, username string) (PrivateUser, error)
- func (q *Queries) TokenExists(ctx context.Context, token string) (int64, error)
- func (q *Queries) UnlikePost(ctx context.Context, arg UnlikePostParams) error
- func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error
- func (q *Queries) User(ctx context.Context, username string) (PublicUser, error)
- func (q *Queries) UserPasshash(ctx context.Context, username string) ([]byte, error)
- func (q *Queries) ValidateSession(ctx context.Context, token string) (ValidateSessionRow, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type Session
- type UnlikePostParams
- type UpdateUserParams
- type User
- type ValidateSessionRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangePasswordParams ¶
type CreatePostParams ¶
type CreatePostParams struct {
ID int64
Username string
CoverHash sql.NullString
Images []string
Description sql.NullString
Tags []string
Location sql.NullString
}
type CreateSessionParams ¶
type CreateSessionParams struct {
Token string
Username string
Metadata json.RawMessage
}
type CreateUserParams ¶
type DeletePostParams ¶
type GetPostParams ¶
type GetPostRow ¶
type GetPostRow struct {
ID int64
Username string
CoverHash sql.NullString
Images []string
Description sql.NullString
Tags []string
Location sql.NullString
Likes int64
Liked int64
}
type LikePostParams ¶
type LikedPostsRow ¶
type LikedPostsRow struct {
ID int64
Username string
CoverHash sql.NullString
Images []string
Description sql.NullString
Tags []string
Location sql.NullString
Likes int64
}
type NextPostsParams ¶
type NextPostsRow ¶
type NextPostsRow struct {
ID int64
Username string
CoverHash sql.NullString
Images []string
Description sql.NullString
Tags []string
Location sql.NullString
Likes int64
Liked int64
}
type Post ¶
type Post struct {
ID int64
Username string
CoverHash sql.NullString
Images []string
Description sql.NullString
Tags []string
Location sql.NullString
}
type PrivateUser ¶
type PrivateUser struct {
Username string
DisplayName sql.NullString
Avatar sql.NullString
Bio sql.NullString
Birthday sql.NullTime
FoodPreferences json.RawMessage
}
type PublicUser ¶
type PublicUser struct {
Username string
DisplayName sql.NullString
Avatar sql.NullString
Bio sql.NullString
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) ChangePassword ¶
func (q *Queries) ChangePassword(ctx context.Context, arg ChangePasswordParams) error
func (*Queries) CreatePost ¶
func (q *Queries) CreatePost(ctx context.Context, arg CreatePostParams) error
CreatePost creates a new post.
func (*Queries) CreateSession ¶
func (*Queries) CreateUser ¶
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) error
func (*Queries) DeletePost ¶
DeletePost deletes a post.
func (*Queries) DeleteSession ¶
TODO: consider returning an indication
func (*Queries) GetPost ¶
func (q *Queries) GetPost(ctx context.Context, arg GetPostParams) (GetPostRow, error)
GetPost gets a single post.
func (*Queries) LikePost ¶
func (q *Queries) LikePost(ctx context.Context, arg LikePostParams) error
LikePost likes a post.
func (*Queries) LikedPosts ¶
LikedPosts returns a user's liked posts.
func (*Queries) NextPosts ¶
func (q *Queries) NextPosts(ctx context.Context, arg NextPostsParams) ([]NextPostsRow, error)
NextPosts paginates the list of posts.
func (*Queries) PostLikeCount ¶
PostLikeCount returns the like count of the post with the given ID.
func (*Queries) TokenExists ¶
TokenExists returns 1 if the token exists or 0.
func (*Queries) UnlikePost ¶
func (q *Queries) UnlikePost(ctx context.Context, arg UnlikePostParams) error
UnlikePost removes a like of the current user from a post.
func (*Queries) UpdateUser ¶
func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error
func (*Queries) UserPasshash ¶
UserPasshash gets a user's password hash.
func (*Queries) ValidateSession ¶
ValidateSession validates the session and returns the username. An error is returned if the session doesn't exist anymore.
type UnlikePostParams ¶
type UpdateUserParams ¶
type UpdateUserParams struct {
Username string
DisplayName sql.NullString
Avatar sql.NullString
Bio sql.NullString
Birthday sql.NullTime
FoodPreferences json.RawMessage
}
type User ¶
type User struct {
Username string
Passhash []byte
DisplayName sql.NullString
Avatar sql.NullString
Bio sql.NullString
Birthday sql.NullTime
FoodPreferences json.RawMessage
}
type ValidateSessionRow ¶
type ValidateSessionRow struct {
Username string
Expiry time.Time
Metadata json.RawMessage
}
Click to show internal directories.
Click to hide internal directories.