Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 62d3c86f8f
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (38 sloc) 0.794 kB
package model
import (
// "io/ioutil"
)
func NewBlob(value []byte) *Blob {
return (*Blob)(&value)
}
/*
Blob is just a bunch of bytes.
Struct tag attributes:
`model:"required"`
*/
type Blob []byte
func (self *Blob) Get() []byte {
return []byte(*self)
}
func (self *Blob) Set(value []byte) {
*self = Blob(value)
}
func (self *Blob) String() string {
return string(*self)
}
func (self *Blob) SetString(str string) error {
*self = Blob(str)
return nil
}
func (self *Blob) IsEmpty() bool {
return len(*self) == 0
}
func (self *Blob) Required(metaData *MetaData) bool {
return metaData.BoolAttrib(StructTagKey, "required")
}
func (self *Blob) Validate(metaData *MetaData) error {
if self.Required(metaData) && self.IsEmpty() {
return NewRequiredError(metaData)
}
return nil
}
Jump to Line
Something went wrong with that request. Please try again.