Documentation ¶
Index ¶
- Constants
- func FitSerializerData(serializer interface{}) interface{}
- func GenericValidate(serializer SerializersInterface) (bool, map[string][]string)
- func InitValuesModel(serializer SerializersInterface) models.BaseModelInterface
- func MarshallSerializer(serializer interface{}) ([]byte, error)
- func VaidatorLengthParam(minLength int, maxLength int) func(*ValidateParams)
- func VaidatorRequiredParam(required bool) func(*ValidateParams)
- func ValidateInt(val int, opts ...ValidateFuncOption) (bool, []string)
- func ValidateString(val string, opts ...ValidateFuncOption) (bool, []string)
- func ValidatorEmailParam() func(*ValidateParams)
- type ErrorMessage
- type Rules
- type Serializer
- func (s *Serializer) AddError(field string, err ...string)
- func (s *Serializer) Data() map[string]interface{}
- func (s *Serializer) Errors() map[string][]string
- func (s *Serializer) GetInstanceModel() models.BaseModelInterface
- func (s *Serializer) GetModel() models.BaseModelInterface
- func (s *Serializer) SetError(err string)
- func (s *Serializer) Validate() bool
- type SerializerModels
- type SerializersInterface
- type ValidateFuncOption
- type ValidateParams
Constants ¶
View Source
const ( SerializerKeyRequired = "required" SerializerKeyReadOnly = "read_only" SerializerKeyWriteOnly = "write_only" SerializerKeyAllowNull = "allow_null" )
Variables ¶
This section is empty.
Functions ¶
func FitSerializerData ¶
func FitSerializerData(serializer interface{}) interface{}
func GenericValidate ¶
func GenericValidate(serializer SerializersInterface) (bool, map[string][]string)
func InitValuesModel ¶
func InitValuesModel(serializer SerializersInterface) models.BaseModelInterface
func MarshallSerializer ¶
func VaidatorLengthParam ¶
func VaidatorLengthParam(minLength int, maxLength int) func(*ValidateParams)
func VaidatorRequiredParam ¶
func VaidatorRequiredParam(required bool) func(*ValidateParams)
func ValidateInt ¶
func ValidateInt(val int, opts ...ValidateFuncOption) (bool, []string)
func ValidateString ¶
func ValidateString(val string, opts ...ValidateFuncOption) (bool, []string)
func ValidatorEmailParam ¶
func ValidatorEmailParam() func(*ValidateParams)
Types ¶
type ErrorMessage ¶
type ErrorMessage string
const (
StringLengthExceeded ErrorMessage = "String length exceeded"
)
type Serializer ¶
type Serializer struct { InstanceModel models.BaseModelInterface `json:"-" gorm:"-"` // contains filtered or unexported fields }
func (*Serializer) AddError ¶
func (s *Serializer) AddError(field string, err ...string)
func (*Serializer) Data ¶
func (s *Serializer) Data() map[string]interface{}
func (*Serializer) Errors ¶
func (s *Serializer) Errors() map[string][]string
func (*Serializer) GetInstanceModel ¶
func (s *Serializer) GetInstanceModel() models.BaseModelInterface
func (*Serializer) GetModel ¶
func (s *Serializer) GetModel() models.BaseModelInterface
func (*Serializer) SetError ¶
func (s *Serializer) SetError(err string)
func (*Serializer) Validate ¶
func (s *Serializer) Validate() bool
type SerializerModels ¶
type SerializerModels interface { SerializersInterface models.BaseModelInterface }
type SerializersInterface ¶
type SerializersInterface interface { Validate() bool Data() map[string]interface{} AddError(field string, err ...string) SetError(err string) GetModel() models.BaseModelInterface GetInstanceModel() models.BaseModelInterface Errors() map[string][]string }
func InitValuesSerializer ¶
func InitValuesSerializer(serializer SerializersInterface, model models.BaseModelInterface) SerializersInterface
type ValidateFuncOption ¶
type ValidateFuncOption func(vp *ValidateParams)
Click to show internal directories.
Click to hide internal directories.