Documentation ¶
Index ¶
- Variables
- func GetCounts(tx *pop.Connection) (map[int]int, error)
- func GetCountsForUser(tx *pop.Connection, u *User) (map[int]int, error)
- type Cap
- func (cap *Cap) Create(tx *pop.Connection) (*validate.Errors, error)
- func (c Cap) String() string
- func (c *Cap) Validate(tx *pop.Connection) (*validate.Errors, error)
- func (c *Cap) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)
- func (c *Cap) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)
- type Caps
- type Field
- type Fields
- type Group
- func (g *Group) AddUser(userID uuid.UUID, admin bool)
- func (g *Group) Create(tx *pop.Connection) (*validate.Errors, error)
- func (g Group) String() string
- func (g *Group) Validate(tx *pop.Connection) (*validate.Errors, error)
- func (g *Group) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)
- func (g *Group) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)
- type Groups
- type InGroup
- type User
- func (u *User) Create(tx *pop.Connection) (*validate.Errors, error)
- func (u *User) SendValidationEmail(tx *pop.Connection) 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) ValidateEmail(tx *pop.Connection) error
- func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)
- type Users
Constants ¶
This section is empty.
Variables ¶
var DB *pop.Connection
DB is a connection to your database to be used throughout your application.
Functions ¶
Types ¶
type Cap ¶
type Cap 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"` Number int `json:"number" db:"number" form:"Number"` BelongsTo *User `json:"belongs_to,omitempty" belongs_to:"user"` BelongsToID uuid.UUID `json:"-" db:"userid"` }
Cap is used by pop to map your .model.Name.Proper.Pluralize.Underscore database table to your go code.
func (*Cap) 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 (*Cap) ValidateCreate ¶
ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.
func (*Cap) ValidateUpdate ¶
ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.
type Field ¶
type Field 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"` Field slices.Int `json:"field" db:"field"` }
Field is used by pop to map your .model.Name.Proper.Pluralize.Underscore database table to your go code.
func (*Field) 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 (*Field) ValidateCreate ¶
ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.
func (*Field) ValidateUpdate ¶
ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.
type Group ¶
type Group 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"` Name string `json:"name" db:"name"` Secret string `json:"secret" db:"secret"` InGroup []InGroup `json:"users" has_many:"ingroup"` }
Group is used by pop to map your .model.Name.Proper.Pluralize.Underscore database table to your go code.
func (*Group) 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 (*Group) ValidateCreate ¶
ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.
func (*Group) ValidateUpdate ¶
ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.
type InGroup ¶
type InGroup struct { ID uuid.UUID `json:"group_id" db:"id"` GroupID uuid.UUID `json:"group_id" db:"group_id"` UserID uuid.UUID `json:"user_id" db:"user_id"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` IsAdmin bool `json:"is_admin" db:"is_admin"` User *User `json:"user,omitempty" belongs_to:"users"` Group *Group `json:"user,omitempty" belongs_to:"groups"` }
func (*InGroup) 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 (*InGroup) ValidateCreate ¶
ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.
func (*InGroup) ValidateUpdate ¶
ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.
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"` Email string `json:"email" db:"email"` PasswordHash string `json:"password_hash" db:"password_hash"` ValidationCode string `json:"-" db:"validation_code"` Validated bool `json:"-" db:"validated"` Password string `json:"-" db:"-"` PasswordConfirmation string `json:"-" db:"-"` Caps []Cap `json:"caps" has_many:"caps"` }
User is a generated model from buffalo-auth, it serves as the base for username/password authentication.
func (*User) Create ¶
Create wraps up the pattern of encrypting the password and running validations. Useful when writing tests.
func (*User) SendValidationEmail ¶
Sends validation email
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) ValidateEmail ¶
func (*User) ValidateUpdate ¶
ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.