Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BankGenerator ¶
func BankGenerator() interface{}
func RateLimiterFunc ¶
func RateLimiterFunc(request *goyave.Request) ratelimiter.Config
RateLimiterFunc returns rate limiting configuration Anonymous users have a quota of 50 requests per minute while Authenticated users are limited to 500 requests per minute.
func UserGenerator ¶
func UserGenerator() interface{}
UserGenerator generator function for the User model. Generate users using the following: database.NewFactory(model.UserGenerator).Generate(5)
Types ¶
type Bank ¶
type Bank struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `json:"deleted_at"` ID uint64 `json:"id" gorm:"primarykey"` Balance float64 `json:"balance"` UserID uint64 `json:"user_id" gorm:"not null"` Operations []Operation `json:"-"` //TODO : replace "-"" }
Bank represents a bank account
type Operation ¶
type Operation struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `json:"deleted_at"` ID uint64 `json:"id" gorm:"primarykey"` Amount float64 `json:"amount"` From string `json:"from"` To string `json:"to"` SenderID uint64 `json:"sender_id" gorm:"not null"` BankID uint64 `json:"receiver_id" gorm:"not null"` // Foreign key of table bank Invoice bool `json:"invoice"` Acquitted bool `json:"acquitted"` DueDate time.Time `json:"due_date"` Transfer bool `json:"transfer"` Instant bool `json:"instant"` Scheduled bool `json:"scheduled"` Date time.Time `json:"date"` Question string `json:"question"` Answer string `json:"answer"` Verified bool `json:"verified"` Try uint `json:"try"` }
Operation represents a operation account
type User ¶
type User struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `json:"deleted_at"` ID uint64 `json:"id" gorm:"primarykey"` Email string `json:"email" gorm:"type:char(100);uniqueIndex;not null" auth:"username"` Password string `json:"-" gorm:"size:64;not null" auth:"password"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Verified bool `json:"verified"` VerificationCode string `json:"verification_code"` Banks []Bank `json:"-"` }
User represents a user
func (*User) BeforeCreate ¶
BeforeCreate hook executed before a User record is inserted in the database. Ensures the password is encrypted using bcrypt, with the cost defined by the config entry "app.bcryptCost".
Click to show internal directories.
Click to hide internal directories.