Ejemplo n.º 1
0
// NewEmailType create new instance of a email type
func NewEmailType(attrs map[string]string) types.CustomType {
	var ptr *string
	return &abstracttype.SimpleCustomType{
		MetaType: &abstracttype.MetaType{
			SQLTypeName:  "varchar(100)",
			HTMLTypeName: "text",
			GoTypeRef:    reflect.TypeOf(ptr).Elem(),
			Attributes:   attrs,
		},
		TypeConverter: abstracttype.NewStringConverter(),
		TypeValidator: validator.NewEmailValidator(),
	}
}
Ejemplo n.º 2
0
func NewTestLengthType() types.CustomType {
	var ptr *string
	return &abstracttype.SimpleCustomType{
		MetaType: &abstracttype.MetaType{
			SQLTypeName:  "varchar(100)",
			HTMLTypeName: "text",
			GoTypeRef:    reflect.TypeOf(ptr).Elem(),
			Attributes:   map[string]string{},
		},
		TypeConverter: abstracttype.NewStringConverter(),
		TypeValidator: NewLengthValidator(3, 7),
	}
}