Documentation
¶
Index ¶
- Variables
- type Comment
- type Comments
- type EmailNotTaken
- type Post
- type Posts
- type User
- func (u *User) Authorize(tx *pop.Connection) error
- func (u *User) Create(tx *pop.Connection) (*validate.Errors, error)
- func (u User) String() string
- func (u *User) Validate(tx *pop.Connection) (*validate.Errors, error)
- func (u *User) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)
- func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)
- type UsernameNotTaken
- type Users
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *pop.Connection
DB is a connection to your database to be used throughout your application.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` Content string `json:"content" db:"content"` AuthorID uuid.UUID `json:"author_id" db:"author_id"` PostID uuid.UUID `json:"post_id" db:"post_id"` Author User `json:"-" db:"-"` }
type EmailNotTaken ¶
func (*EmailNotTaken) IsValid ¶
func (v *EmailNotTaken) IsValid(errors *validate.Errors)
IsValid performs the validation check for unique emails
type Post ¶
type Post struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` Title string `json:"title" db:"title"` Content string `json:"content" db:"content"` AuthorID uuid.UUID `json:"author_id" db:"author_id"` }
type User ¶
type User struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` Username string `json:"username" db:"username"` Email string `json:"email" db:"email"` Admin bool `json:"admin" db:"admin"` PasswordHash string `json:"-" db:"password_hash"` Password string `json:"-" db:"-"` PasswordConfirm string `json:"-" db:"-"` }
func (*User) Authorize ¶
func (u *User) Authorize(tx *pop.Connection) error
Authorize checks user's password for logging in
func (*User) Validate ¶
Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.
func (*User) ValidateCreate ¶
ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.
func (*User) ValidateUpdate ¶
ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.
type UsernameNotTaken ¶
func (*UsernameNotTaken) IsValid ¶
func (v *UsernameNotTaken) IsValid(errors *validate.Errors)
Click to show internal directories.
Click to hide internal directories.