Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { ID uint64 `gorm:"primary_key;AUTO_INCREMENT" json:"id"` Title string `gorm:"size:250;not_null;unique" json:"title" validate:"required"` Body string `gorm:"size:500;" json:"body"` AuthorID uint64 `gorm:"not_null" json:"author_id" validate:"required"` Author User `gorm:"foreignkey:AuthorID" json:"author"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `json:"deleted_at,omitempty" sql:"index"` }
Article struct
type ArticleInterface ¶
type ArticleInterface interface { GetAllArticles() ([]Article, error) SaveArticle(a *Article) (*Article, error) FetchArticleByID(id uint64) (Article, error) DeleteByID(id uint64, uid uint64) (int64, error) UpdateArticle(a *Article, id int64, uid uint64) (int64, error) DeleteAllArticles() (int64, error) }
ArticleInterface -
type AuthInterface ¶
AuthInterface -
type User ¶
type User struct { ID uint64 `gorm:"primary_key;AUTO_INCREMENT" json:"id"` Nickname string `gorm:"size:20;not null,unique" json:"nickname" validate:"required"` Email string `gorm:"size:20;not null,unique" json:"email" validate:"required,email"` Password string `gorm:"size:60;not null" json:"password" validate:"required"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` Articles []Article `json:"articles,omitempty"` }
User struct
Click to show internal directories.
Click to hide internal directories.