Documentation ¶
Index ¶
- Variables
- func AutoMigrate(config config.Config)
- func Close(conn *pgx.Conn)
- func Connect(config config.Config) *pgx.Conn
- func Drop(config config.Config)
- func InitTestDB(config *config.Config)
- func Nullable[T any](row *T, err error) (*T, error)
- func NullableID(row string, err error) (string, error)
- type AddCommentParams
- type Article
- type ArticleTag
- type Comment
- type ConduitStore
- func (store *ConduitStore) CreateArticleTx(ctx context.Context, arg CreateArticleTxParams) (*CreateArticleTxResult, error)
- func (store *ConduitStore) DeleteArticleTx(ctx context.Context, arg DeleteArticleTxParams) error
- func (store *ConduitStore) DeleteCommentTx(ctx context.Context, arg DeleteCommentTxParams) error
- func (store *ConduitStore) FavoriteArticleTx(ctx context.Context, arg FavoriteArticleTxParams) (*FavoriteArticleTxResult, error)
- func (store *ConduitStore) UnfavoriteArticleTx(ctx context.Context, arg UnfavoriteArticleTxParams) (*UnfavoriteArticleTxResult, error)
- func (store *ConduitStore) UpdateArticleTx(ctx context.Context, arg UpdateArticleTxParams) (*UpdateArticleTxResult, error)
- type CreateArticleParams
- type CreateArticleTagParams
- type CreateArticleTxParams
- type CreateArticleTxResult
- type CreateTagParams
- type CreateUserParams
- type DBTX
- type DeleteArticleTxParams
- type DeleteCommentTxParams
- type DoesFavoriteExistParams
- type Favorite
- type FavoriteArticleParams
- type FavoriteArticleTxParams
- type FavoriteArticleTxResult
- type Follow
- type FollowUserParams
- type GetArticleAuthorIDBySlugRow
- type GetArticleBySlugRow
- type GetArticlesByAuthorParams
- type GetArticlesByAuthorRow
- type GetArticlesByFavoritedParams
- type GetArticlesByFavoritedRow
- type GetArticlesByTagParams
- type GetArticlesByTagRow
- type GetArticlesFeedParams
- type GetArticlesFeedRow
- type GetArticlesParams
- type GetArticlesRow
- type GetCommentsBySlugRow
- type IsFollowingListParams
- type IsFollowingParams
- type Querier
- type Queries
- func (q *Queries) AddComment(ctx context.Context, arg AddCommentParams) (*Comment, error)
- func (q *Queries) CountArticles(ctx context.Context) (int64, error)
- func (q *Queries) CountArticlesByAuthor(ctx context.Context, username string) (int64, error)
- func (q *Queries) CountArticlesByFavorited(ctx context.Context, username string) (int64, error)
- func (q *Queries) CountArticlesByTag(ctx context.Context, name string) (int64, error)
- func (q *Queries) CountArticlesFeed(ctx context.Context, followerID string) (int64, error)
- func (q *Queries) CreateArticle(ctx context.Context, arg CreateArticleParams) (*Article, error)
- func (q *Queries) CreateArticleTag(ctx context.Context, arg CreateArticleTagParams) (*ArticleTag, error)
- func (q *Queries) CreateTag(ctx context.Context, arg CreateTagParams) (string, error)
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (*User, error)
- func (q *Queries) DeleteArticle(ctx context.Context, slug string) error
- func (q *Queries) DeleteComment(ctx context.Context, id string) error
- func (q *Queries) DoesFavoriteExist(ctx context.Context, arg DoesFavoriteExistParams) (bool, error)
- func (q *Queries) DoesUserExist(ctx context.Context, id string) (bool, error)
- func (q *Queries) FavoriteArticle(ctx context.Context, arg FavoriteArticleParams) error
- func (q *Queries) FollowUser(ctx context.Context, arg FollowUserParams) error
- func (q *Queries) GetArticleAuthorID(ctx context.Context, slug string) (string, error)
- func (q *Queries) GetArticleAuthorIDBySlug(ctx context.Context, slug string) (*GetArticleAuthorIDBySlugRow, error)
- func (q *Queries) GetArticleBySlug(ctx context.Context, slug string) (*GetArticleBySlugRow, error)
- func (q *Queries) GetArticleIDBySlug(ctx context.Context, slug string) (string, error)
- func (q *Queries) GetArticles(ctx context.Context, arg GetArticlesParams) ([]*GetArticlesRow, error)
- func (q *Queries) GetArticlesByAuthor(ctx context.Context, arg GetArticlesByAuthorParams) ([]*GetArticlesByAuthorRow, error)
- func (q *Queries) GetArticlesByFavorited(ctx context.Context, arg GetArticlesByFavoritedParams) ([]*GetArticlesByFavoritedRow, error)
- func (q *Queries) GetArticlesByTag(ctx context.Context, arg GetArticlesByTagParams) ([]*GetArticlesByTagRow, error)
- func (q *Queries) GetArticlesFeed(ctx context.Context, arg GetArticlesFeedParams) ([]*GetArticlesFeedRow, error)
- func (q *Queries) GetCommentAuthorID(ctx context.Context, id string) (string, error)
- func (q *Queries) GetCommentsBySlug(ctx context.Context, slug string) ([]*GetCommentsBySlugRow, error)
- func (q *Queries) GetFollowees(ctx context.Context, followerID string) ([]*Follow, error)
- func (q *Queries) GetTags(ctx context.Context) ([]string, error)
- func (q *Queries) GetUser(ctx context.Context, id string) (*User, error)
- func (q *Queries) GetUserByEmail(ctx context.Context, email string) (*User, error)
- func (q *Queries) GetUserByUsername(ctx context.Context, username string) (*User, error)
- func (q *Queries) IsFollowing(ctx context.Context, arg IsFollowingParams) (bool, error)
- func (q *Queries) IsFollowingList(ctx context.Context, arg IsFollowingListParams) ([]bool, error)
- func (q *Queries) UnfavoriteArticle(ctx context.Context, arg UnfavoriteArticleParams) error
- func (q *Queries) UnfollowUser(ctx context.Context, arg UnfollowUserParams) error
- func (q *Queries) UpdateArticle(ctx context.Context, arg UpdateArticleParams) (*Article, error)
- func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (*User, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type Store
- type Tag
- type UnfavoriteArticleParams
- type UnfavoriteArticleTxParams
- type UnfavoriteArticleTxResult
- type UnfollowUserParams
- type UpdateArticleParams
- type UpdateArticleTxParams
- type UpdateArticleTxResult
- type UpdateUserParams
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("resourse not found") ErrForbidden = errors.New("action forbidden") )
Functions ¶
func AutoMigrate ¶
func InitTestDB ¶
Types ¶
type AddCommentParams ¶
type ArticleTag ¶
type ConduitStore ¶
type ConduitStore struct { *Queries // implements Querier // contains filtered or unexported fields }
func (*ConduitStore) CreateArticleTx ¶
func (store *ConduitStore) CreateArticleTx( ctx context.Context, arg CreateArticleTxParams, ) (*CreateArticleTxResult, error)
func (*ConduitStore) DeleteArticleTx ¶
func (store *ConduitStore) DeleteArticleTx( ctx context.Context, arg DeleteArticleTxParams, ) error
func (*ConduitStore) DeleteCommentTx ¶
func (store *ConduitStore) DeleteCommentTx( ctx context.Context, arg DeleteCommentTxParams, ) error
func (*ConduitStore) FavoriteArticleTx ¶
func (store *ConduitStore) FavoriteArticleTx( ctx context.Context, arg FavoriteArticleTxParams, ) (*FavoriteArticleTxResult, error)
func (*ConduitStore) UnfavoriteArticleTx ¶
func (store *ConduitStore) UnfavoriteArticleTx( ctx context.Context, arg UnfavoriteArticleTxParams, ) (*UnfavoriteArticleTxResult, error)
func (*ConduitStore) UpdateArticleTx ¶
func (store *ConduitStore) UpdateArticleTx( ctx context.Context, arg UpdateArticleTxParams, ) (*UpdateArticleTxResult, error)
type CreateArticleParams ¶
type CreateArticleTagParams ¶
type CreateArticleTxParams ¶
type CreateArticleTxParams struct { CreateArticleParams Tags []string }
type CreateArticleTxResult ¶
type CreateTagParams ¶
type CreateUserParams ¶
type DeleteArticleTxParams ¶
type DeleteCommentTxParams ¶
type DoesFavoriteExistParams ¶
type FavoriteArticleParams ¶
type FavoriteArticleTxParams ¶
type FavoriteArticleTxResult ¶
type FavoriteArticleTxResult struct { Article *GetArticleBySlugRow Favorited bool Following bool }
type FollowUserParams ¶
type GetArticleBySlugRow ¶
type GetArticleBySlugRow struct { ID string `json:"id"` Slug string `json:"slug"` Title string `json:"title"` Description string `json:"description"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` FavoritesCount int64 `json:"favorites_count"` TagList interface{} `json:"tag_list"` AuthorID string `json:"author_id"` Username string `json:"username"` Bio *string `json:"bio"` Image *string `json:"image"` }
type GetArticlesByAuthorRow ¶
type GetArticlesByAuthorRow struct { ID string `json:"id"` Slug string `json:"slug"` Title string `json:"title"` Description string `json:"description"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` FavoritesCount *int64 `json:"favorites_count"` Favorited bool `json:"favorited"` Following bool `json:"following"` TagList interface{} `json:"tag_list"` Username *string `json:"username"` Bio *string `json:"bio"` Image *string `json:"image"` }
type GetArticlesByFavoritedRow ¶
type GetArticlesByFavoritedRow struct { ID string `json:"id"` Slug string `json:"slug"` Title string `json:"title"` Description string `json:"description"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` FavoritesCount *int64 `json:"favorites_count"` Favorited bool `json:"favorited"` Following bool `json:"following"` TagList interface{} `json:"tag_list"` Username *string `json:"username"` Bio *string `json:"bio"` Image *string `json:"image"` }
type GetArticlesByTagParams ¶
type GetArticlesByTagRow ¶
type GetArticlesByTagRow struct { ID string `json:"id"` Slug string `json:"slug"` Title string `json:"title"` Description string `json:"description"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` FavoritesCount *int64 `json:"favorites_count"` Favorited bool `json:"favorited"` Following bool `json:"following"` TagList interface{} `json:"tag_list"` Username *string `json:"username"` Bio *string `json:"bio"` Image *string `json:"image"` }
type GetArticlesFeedParams ¶
type GetArticlesFeedRow ¶
type GetArticlesFeedRow struct { ID string `json:"id"` Slug string `json:"slug"` Title string `json:"title"` Description string `json:"description"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` FavoritesCount *int64 `json:"favorites_count"` Favorited bool `json:"favorited"` TagList interface{} `json:"tag_list"` Username *string `json:"username"` Bio *string `json:"bio"` Image *string `json:"image"` }
type GetArticlesParams ¶
type GetArticlesRow ¶
type GetArticlesRow struct { ID string `json:"id"` Slug string `json:"slug"` Title string `json:"title"` Description string `json:"description"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` FavoritesCount *int64 `json:"favorites_count"` Favorited bool `json:"favorited"` Following bool `json:"following"` TagList interface{} `json:"tag_list"` Username *string `json:"username"` Bio *string `json:"bio"` Image *string `json:"image"` }
type GetCommentsBySlugRow ¶
type IsFollowingListParams ¶
type IsFollowingParams ¶
type Querier ¶
type Querier interface { AddComment(ctx context.Context, arg AddCommentParams) (*Comment, error) CountArticles(ctx context.Context) (int64, error) CountArticlesByAuthor(ctx context.Context, username string) (int64, error) CountArticlesByFavorited(ctx context.Context, username string) (int64, error) CountArticlesByTag(ctx context.Context, name string) (int64, error) CountArticlesFeed(ctx context.Context, followerID string) (int64, error) CreateArticle(ctx context.Context, arg CreateArticleParams) (*Article, error) CreateArticleTag(ctx context.Context, arg CreateArticleTagParams) (*ArticleTag, error) CreateTag(ctx context.Context, arg CreateTagParams) (string, error) CreateUser(ctx context.Context, arg CreateUserParams) (*User, error) DeleteArticle(ctx context.Context, slug string) error DeleteComment(ctx context.Context, id string) error DoesFavoriteExist(ctx context.Context, arg DoesFavoriteExistParams) (bool, error) DoesUserExist(ctx context.Context, id string) (bool, error) FavoriteArticle(ctx context.Context, arg FavoriteArticleParams) error FollowUser(ctx context.Context, arg FollowUserParams) error GetArticleAuthorID(ctx context.Context, slug string) (string, error) GetArticleAuthorIDBySlug(ctx context.Context, slug string) (*GetArticleAuthorIDBySlugRow, error) GetArticleBySlug(ctx context.Context, slug string) (*GetArticleBySlugRow, error) GetArticleIDBySlug(ctx context.Context, slug string) (string, error) GetArticles(ctx context.Context, arg GetArticlesParams) ([]*GetArticlesRow, error) GetArticlesByAuthor(ctx context.Context, arg GetArticlesByAuthorParams) ([]*GetArticlesByAuthorRow, error) GetArticlesByFavorited(ctx context.Context, arg GetArticlesByFavoritedParams) ([]*GetArticlesByFavoritedRow, error) GetArticlesByTag(ctx context.Context, arg GetArticlesByTagParams) ([]*GetArticlesByTagRow, error) GetArticlesFeed(ctx context.Context, arg GetArticlesFeedParams) ([]*GetArticlesFeedRow, error) GetCommentAuthorID(ctx context.Context, id string) (string, error) GetCommentsBySlug(ctx context.Context, slug string) ([]*GetCommentsBySlugRow, error) GetFollowees(ctx context.Context, followerID string) ([]*Follow, error) GetTags(ctx context.Context) ([]string, error) GetUser(ctx context.Context, id string) (*User, error) GetUserByEmail(ctx context.Context, email string) (*User, error) GetUserByUsername(ctx context.Context, username string) (*User, error) IsFollowing(ctx context.Context, arg IsFollowingParams) (bool, error) IsFollowingList(ctx context.Context, arg IsFollowingListParams) ([]bool, error) UnfavoriteArticle(ctx context.Context, arg UnfavoriteArticleParams) error UnfollowUser(ctx context.Context, arg UnfollowUserParams) error UpdateArticle(ctx context.Context, arg UpdateArticleParams) (*Article, error) UpdateUser(ctx context.Context, arg UpdateUserParams) (*User, error) }
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AddComment ¶
func (*Queries) CountArticlesByAuthor ¶
func (*Queries) CountArticlesByFavorited ¶
func (*Queries) CountArticlesByTag ¶
func (*Queries) CountArticlesFeed ¶
func (*Queries) CreateArticle ¶
func (*Queries) CreateArticleTag ¶
func (q *Queries) CreateArticleTag(ctx context.Context, arg CreateArticleTagParams) (*ArticleTag, error)
func (*Queries) CreateUser ¶
func (*Queries) DeleteArticle ¶
func (*Queries) DeleteComment ¶
func (*Queries) DoesFavoriteExist ¶
func (*Queries) DoesUserExist ¶
func (*Queries) FavoriteArticle ¶
func (q *Queries) FavoriteArticle(ctx context.Context, arg FavoriteArticleParams) error
func (*Queries) FollowUser ¶
func (q *Queries) FollowUser(ctx context.Context, arg FollowUserParams) error
func (*Queries) GetArticleAuthorID ¶
func (*Queries) GetArticleAuthorIDBySlug ¶
func (*Queries) GetArticleBySlug ¶
func (*Queries) GetArticleIDBySlug ¶
func (*Queries) GetArticles ¶
func (q *Queries) GetArticles(ctx context.Context, arg GetArticlesParams) ([]*GetArticlesRow, error)
func (*Queries) GetArticlesByAuthor ¶
func (q *Queries) GetArticlesByAuthor(ctx context.Context, arg GetArticlesByAuthorParams) ([]*GetArticlesByAuthorRow, error)
func (*Queries) GetArticlesByFavorited ¶
func (q *Queries) GetArticlesByFavorited(ctx context.Context, arg GetArticlesByFavoritedParams) ([]*GetArticlesByFavoritedRow, error)
func (*Queries) GetArticlesByTag ¶
func (q *Queries) GetArticlesByTag(ctx context.Context, arg GetArticlesByTagParams) ([]*GetArticlesByTagRow, error)
func (*Queries) GetArticlesFeed ¶
func (q *Queries) GetArticlesFeed(ctx context.Context, arg GetArticlesFeedParams) ([]*GetArticlesFeedRow, error)
func (*Queries) GetCommentAuthorID ¶
func (*Queries) GetCommentsBySlug ¶
func (*Queries) GetFollowees ¶
func (*Queries) GetUserByEmail ¶
func (*Queries) GetUserByUsername ¶
func (*Queries) IsFollowing ¶
func (*Queries) IsFollowingList ¶
func (*Queries) UnfavoriteArticle ¶
func (q *Queries) UnfavoriteArticle(ctx context.Context, arg UnfavoriteArticleParams) error
func (*Queries) UnfollowUser ¶
func (q *Queries) UnfollowUser(ctx context.Context, arg UnfollowUserParams) error
func (*Queries) UpdateArticle ¶
func (*Queries) UpdateUser ¶
type Store ¶
type Store interface { Querier // Querier gives access sqlc-generated methods CreateArticleTx(ctx context.Context, arg CreateArticleTxParams) (*CreateArticleTxResult, error) UpdateArticleTx(ctx context.Context, arg UpdateArticleTxParams) (*UpdateArticleTxResult, error) FavoriteArticleTx(ctx context.Context, arg FavoriteArticleTxParams) (*FavoriteArticleTxResult, error) UnfavoriteArticleTx(ctx context.Context, arg UnfavoriteArticleTxParams) (*UnfavoriteArticleTxResult, error) DeleteArticleTx(ctx context.Context, arg DeleteArticleTxParams) error DeleteCommentTx(ctx context.Context, arg DeleteCommentTxParams) error }
func NewConduitStore ¶
func NewConduitStore(db *pgx.Conn) Store
type UnfavoriteArticleParams ¶
type UnfavoriteArticleTxResult ¶
type UnfavoriteArticleTxResult struct { Article *GetArticleBySlugRow Favorited bool Following bool }
type UnfollowUserParams ¶
type UpdateArticleParams ¶
type UpdateArticleTxParams ¶
type UpdateArticleTxParams struct {
UpdateArticleParams
}
type UpdateArticleTxResult ¶
type UpdateArticleTxResult struct { Article *GetArticleBySlugRow Favorited bool Following bool }
type UpdateUserParams ¶
Click to show internal directories.
Click to hide internal directories.