Documentation ¶
Index ¶
- func AddPost(user *User, post *Post) error
- func AddUser(user *User) error
- func DeletePost(post *Post) error
- func FetchUserPosts(user *User) error
- func GenerateSalt() ([]byte, error)
- func GetDBConnection() *pg.DB
- func SetDBConnection(dbOpts *pg.Options)
- func UpdatePost(post *Post) error
- type Post
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeletePost ¶
func FetchUserPosts ¶
func GenerateSalt ¶
func GetDBConnection ¶
func GetDBConnection() *pg.DB
func SetDBConnection ¶
func SetDBConnection(dbOpts *pg.Options)
func UpdatePost ¶
Types ¶
type Post ¶
type User ¶
type User struct { ID int Username string `binding:"required,min=3,max=30"` Password string `pg:"-" binding:"required,min=5,max=32"` HashedPassword []byte `json:"-"` Salt []byte `json:"-"` CreatedAt time.Time ModifiedAt time.Time Posts []*Post `json:"-" pg:"fk:user_id,rel:has-many,on_delete:CASCADE"` }
func Authenticate ¶
Click to show internal directories.
Click to hide internal directories.