Documentation
¶
Index ¶
- func CreateUser(user interface{}) (util.Entity, error)
- func DeleteUser(id int) error
- func GetUser(id int) (util.Entity, error)
- func PatchUser(user interface{}) error
- func Register(e *echo.Group, database *gorm.DB, config *Config)
- func UpdateUser(user interface{}) error
- type Config
- type User
- type UserAttributes
- type UserRegistration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUser ¶
CreateUser creates a new user using the specified model
func PatchUser ¶
func PatchUser(user interface{}) error
PatchUser does a partial update on the specified user
Types ¶
type Config ¶
type Config struct {
ResultsPerPage int `mapstructure:"default-results-per-page"`
}
Config is the configuration for the user API
type User ¶
type User struct {
util.EntityImpl
UserName string `gorm:"type:varchar(20);index;not null"`
FirstName string `gorm:"type:varchar(20);index;not null"`
MiddleName string `gorm:"type:varchar(20)"`
LastName string `gorm:"type:varchar(50);index;not null"`
PrimaryEmail string `gorm:"type:varchar(35);unique_index;not null"`
Organization string `gorm:"type:varchar(10);index;not null"`
Sex string `gorm:"type:varchar(1)"`
}
User DTO
type UserAttributes ¶
type UserRegistration ¶
type UserRegistration struct {
FirstName string `json:"firstName"`
MiddleName *string `json:"middleName;omitempty"`
LastName string `json:"lastName"`
Nickname string `json:"nickname"`
UserName string `json:"userName"`
Password string `json:"password"`
PrimaryEmail string `json:"primaryEmail"`
Organization string `json:"organization"`
Gender string `json:"gender" valid:"in(m|M|F|f)"`
VerificationCode string `json:"verificationCode"`
}
UserRegistration data
func (*UserRegistration) Validate ¶
func (reg *UserRegistration) Validate() ([]string, error)
Validate the UserRegistration this has to be in reference to fields.. find an elegant way to build that up for now just use an array of strings