Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
NewService instantiates a new Service layer for customer
Types ¶
type Model ¶
type Model struct { gorm.Model ID uuid.UUID `json:"id" gorm:"primarykey;index;unique"` Email string `json:"email" validate:"required,email" gorm:"index"` Username string `json:"username" validate:"required" gorm:"index"` Password string `json:"password" validate:"required,min=10"` FirstName string `json:"first_name" validate:"required,min=2"` LastName string `json:"last_name" validate:"required,min=2"` LastLogin time.Time `json:"last_login" validate:""` IsActive bool `json:"is_active,omitempty" gorm:"default:false"` Lang string `json:"lang,omitempty" gorm:"default:'en'"` IsBlocked bool `json:"is_blocked" gorm:"default:false"` APIKeys pq.StringArray `json:"api_keys,omitempty" gorm:"type:varchar(255)[]"` Preferences preferences.Model `gorm:"constraint:OnDelete:CASCADE;foreignKey:UserID"` Analysis []analysis.Model `gorm:"constraint:OnDelete:CASCADE;foreignKey:UserID"` } //@name User
Model user struct with validation
func (*Model) BeforeCreate ¶
BeforeCreate encrypt the password before creating
type Service ¶
type Service interface { GetUser(ID string) (user *Model, err error) GetUserByEmail(email string) (user *Model, err error) CreateUser(user *Model) (err error) NewLogin(ID string) (time.Time, error) NewAPIKey(ID, key string) (err error) }
Service interface exports available methods for user service
Click to show internal directories.
Click to hide internal directories.