Documentation ¶
Index ¶
- Variables
- func NewRandomID() uint32
- func NewValidator() *validator.Validate
- func ValidateBeforeNow(fl validator.FieldLevel) bool
- func ValidateDate(field reflect.Value) interface{}
- func ValidateOrgName(fl validator.FieldLevel) bool
- func ValidatePersonName(fl validator.FieldLevel) bool
- type Customer
- type CustomerType
- type Info
- type OrganizationInfo
- type PersonInfo
- type State
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrTypeNotEqual = errors.New("Type not equal")
)
Functions ¶
func NewRandomID ¶
func NewRandomID() uint32
func NewValidator ¶
func NewValidator() *validator.Validate
func ValidateBeforeNow ¶
func ValidateBeforeNow(fl validator.FieldLevel) bool
func ValidateDate ¶
func ValidateOrgName ¶
func ValidateOrgName(fl validator.FieldLevel) bool
func ValidatePersonName ¶
func ValidatePersonName(fl validator.FieldLevel) bool
Types ¶
type Customer ¶
type Customer struct { ID uint32 `validate:"required"` State State `validate:"min=1,max=3"` Info `validate:"required"` }
func NewWithRandomID ¶
func (*Customer) UpdateInfo ¶
type Info ¶
type Info interface {
Type() CustomerType
}
type OrganizationInfo ¶
type OrganizationInfo struct { Name string `validate:"org-name"` Form string `validate:"required"` LeagalID string `validate:"required"` RegistrationDate date.Date `validate:"required,before"` RegistrationCountry string `validate:"required,iso3166_1_alpha2"` }
func (*OrganizationInfo) Type ¶
func (oi *OrganizationInfo) Type() CustomerType
type PersonInfo ¶
type PersonInfo struct { GivenName string `validate:"person-name"` FamilyName string `validate:"person-name"` SSN string `validate:"required"` DateOfBirth date.Date `validate:"required,before"` Citizenship string `validate:"required,iso3166_1_alpha2"` }
func (*PersonInfo) Type ¶
func (pi *PersonInfo) Type() CustomerType
Click to show internal directories.
Click to hide internal directories.