Documentation ¶
Index ¶
- func CamelToSnakeASCII(s string) string
- type PostgresArticle
- type PostgresProfile
- type Store
- func (s *Store) AddUser(user *app.User) error
- func (s Store) CreateArticle(a *app.Article) error
- func (s Store) DeleteArticle(id int) error
- func (s Store) FollowProfile(follower, followee *app.Profile) error
- func (s Store) GetArticle(slug string) (*app.Article, error)
- func (s *Store) GetProfile(username string, follower *app.Profile) (*app.Profile, error)
- func (s *Store) GetUser(email string) (*app.User, error)
- func (s *Store) GetUserById(id int) (*app.User, error)
- func (s Store) ListArticles(f *app.ArticleListFilter) ([]*app.Article, error)
- func (s Store) UnfollowProfile(follower, followee *app.Profile) error
- func (s Store) UpdateArticle(a *app.Article) error
- func (s *Store) UpdateUser(user *app.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelToSnakeASCII ¶
CamelToSnakeASCII converts camel case strings to snake case. It's used as a mapper for sqlx. It's a simplified version of the same name function found in https://github.com/scylladb/go-reflectx.
Types ¶
type PostgresArticle ¶
type PostgresArticle struct { Id int Slug string Title string Description sql.NullString Body sql.NullString Created time.Time Updated time.Time AuthorId int AuthorName string AuthorBio string AuthorImage sql.NullString Following bool }
PostgresArticle is the same as app.Article but specific for articles list queries. It expands Author type to its fields and uses sql.Null* types. All of this is needed to allow scanning query result.
type PostgresProfile ¶
type PostgresProfile struct { Id int Name string Bio sql.NullString Image sql.NullString Following bool }
PostgresProfile is the same as app.Profile but suitable for StructScan method because it has sql.Null* types.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (Store) DeleteArticle ¶
func (Store) GetArticle ¶
Get returns a single article by its slug
func (*Store) GetProfile ¶
func (Store) ListArticles ¶
func (Store) UnfollowProfile ¶
Click to show internal directories.
Click to hide internal directories.