Documentation
¶
Index ¶
- type AccessDetails
- type AllArticleResponse
- type Article
- type ArticleModel
- func (m ArticleModel) All(userID int64) (articles []DataList, err error)
- func (m ArticleModel) Create(userID int64, form forms.CreateArticleForm) (articleID int64, err error)
- func (m ArticleModel) Delete(userID, id int64) (err error)
- func (m ArticleModel) One(userID, id int64) (article Article, err error)
- func (m ArticleModel) Update(userID int64, id int64, form forms.CreateArticleForm) (err error)
- type ArticleResponse
- type AuthModel
- func (m AuthModel) CreateAuth(userid int64, td *TokenDetails) error
- func (m AuthModel) CreateToken(userID int64) (*TokenDetails, error)
- func (m AuthModel) DeleteAuth(givenUUID string) (int64, error)
- func (m AuthModel) ExtractToken(r *http.Request) string
- func (m AuthModel) ExtractTokenMetadata(r *http.Request) (*AccessDetails, error)
- func (m AuthModel) FetchAuth(authD *AccessDetails) (int64, error)
- func (m AuthModel) TokenValid(r *http.Request) error
- func (m AuthModel) VerifyToken(r *http.Request) (*jwt.Token, error)
- type AuthResponse
- type DataList
- type JSONRaw
- type MessageResponse
- type Meta
- type OneArticleResponse
- type Result
- type Token
- type TokenDetails
- type User
- type UserLoginResponse
- type UserModel
- type UserResponse
- type UserSessionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllArticleResponse ¶
type AllArticleResponse struct {
Results []Result `json:"results"`
}
Response represents the top-level structure
type Article ¶
type Article struct {
ID int64 `db:"id, primarykey, autoincrement" json:"id"`
UserID int64 `db:"user_id" json:"-"`
Title string `db:"title" json:"title"`
Content string `db:"content" json:"content"`
UpdatedAt int64 `db:"updated_at" json:"updated_at"`
CreatedAt int64 `db:"created_at" json:"created_at"`
User *JSONRaw `db:"user" json:"user"`
}
Article ...
type ArticleModel ¶
type ArticleModel struct{}
ArticleModel ...
func (ArticleModel) All ¶
func (m ArticleModel) All(userID int64) (articles []DataList, err error)
All ...
func (ArticleModel) Create ¶
func (m ArticleModel) Create(userID int64, form forms.CreateArticleForm) (articleID int64, err error)
Create ...
func (ArticleModel) One ¶
func (m ArticleModel) One(userID, id int64) (article Article, err error)
One ...
func (ArticleModel) Update ¶
func (m ArticleModel) Update(userID int64, id int64, form forms.CreateArticleForm) (err error)
Update ...
type ArticleResponse ¶
type ArticleResponse struct {
ID int `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
UpdatedAt int64 `json:"updated_at"`
CreatedAt int64 `json:"created_at"`
User UserResponse `json:"user"`
}
Article represents an individual article
type AuthModel ¶
type AuthModel struct{}
AuthModel ...
func (AuthModel) CreateAuth ¶
func (m AuthModel) CreateAuth(userid int64, td *TokenDetails) error
CreateAuth ...
func (AuthModel) CreateToken ¶
func (m AuthModel) CreateToken(userID int64) (*TokenDetails, error)
CreateToken ...
func (AuthModel) DeleteAuth ¶
DeleteAuth ...
func (AuthModel) ExtractToken ¶
ExtractToken ...
func (AuthModel) ExtractTokenMetadata ¶
func (m AuthModel) ExtractTokenMetadata(r *http.Request) (*AccessDetails, error)
ExtractTokenMetadata ...
type AuthResponse ¶
type JSONRaw ¶
type JSONRaw json.RawMessage
JSONRaw ...
func (*JSONRaw) UnmarshalJSON ¶
UnmarshalJSON ...
type MessageResponse ¶
type MessageResponse struct {
Message string `json:"message"`
}
type Meta ¶
type Meta struct {
Total int `json:"total"`
}
Meta represents metadata for pagination or total count
type OneArticleResponse ¶
type OneArticleResponse struct {
Data ArticleResponse `json:"data"`
}
type Result ¶
type Result struct {
Data []ArticleResponse `json:"data"`
Meta Meta `json:"meta"`
}
Result represents each result item
type Token ¶
type Token struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
}
Token ...
type TokenDetails ¶
type TokenDetails struct {
AccessToken string
RefreshToken string
AccessUUID string
RefreshUUID string
AtExpires int64
RtExpires int64
}
TokenDetails ...
type User ¶
type User struct {
ID int64 `db:"id, primarykey, autoincrement" json:"id"`
Email string `db:"email" json:"email"`
Password string `db:"password" json:"-"`
Name string `db:"name" json:"name"`
UpdatedAt int64 `db:"updated_at" json:"-"`
CreatedAt int64 `db:"created_at" json:"-"`
}
User ...
type UserLoginResponse ¶
type UserResponse ¶
type UserResponse struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
}
User represents the article's author
type UserSessionInfo ¶
type UserSessionInfo struct {
ID int64 `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
}
UserSessionInfo ...
Click to show internal directories.
Click to hide internal directories.