1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 10:40:49 +00:00

orm fix for support custom field

This commit is contained in:
slene 2013-11-01 23:54:28 +08:00
parent a4df6e403c
commit 1d44018128
3 changed files with 7 additions and 63 deletions

View File

@ -97,10 +97,6 @@ func (e *BooleanField) RawValue() interface{} {
return e.Value()
}
func (e *BooleanField) Clean() error {
return nil
}
var _ Fielder = new(BooleanField)
// A string field
@ -139,10 +135,6 @@ func (e *CharField) RawValue() interface{} {
return e.Value()
}
func (e *CharField) Clean() error {
return nil
}
var _ Fielder = new(CharField)
// A date, represented in go by a time.Time instance.
@ -196,10 +188,6 @@ func (e *DateField) RawValue() interface{} {
return e.Value()
}
func (e *DateField) Clean() error {
return nil
}
var _ Fielder = new(DateField)
// A date, represented in go by a time.Time instance.
@ -243,10 +231,6 @@ func (e *DateTimeField) RawValue() interface{} {
return e.Value()
}
func (e *DateTimeField) Clean() error {
return nil
}
var _ Fielder = new(DateTimeField)
// A floating-point number represented in go by a float32 value.
@ -289,10 +273,6 @@ func (e *FloatField) RawValue() interface{} {
return e.Value()
}
func (e *FloatField) Clean() error {
return nil
}
var _ Fielder = new(FloatField)
// -32768 to 32767
@ -333,10 +313,6 @@ func (e *SmallIntegerField) RawValue() interface{} {
return e.Value()
}
func (e *SmallIntegerField) Clean() error {
return nil
}
var _ Fielder = new(SmallIntegerField)
// -2147483648 to 2147483647
@ -377,10 +353,6 @@ func (e *IntegerField) RawValue() interface{} {
return e.Value()
}
func (e *IntegerField) Clean() error {
return nil
}
var _ Fielder = new(IntegerField)
// -9223372036854775808 to 9223372036854775807.
@ -421,10 +393,6 @@ func (e *BigIntegerField) RawValue() interface{} {
return e.Value()
}
func (e *BigIntegerField) Clean() error {
return nil
}
var _ Fielder = new(BigIntegerField)
// 0 to 65535
@ -465,10 +433,6 @@ func (e *PositiveSmallIntegerField) RawValue() interface{} {
return e.Value()
}
func (e *PositiveSmallIntegerField) Clean() error {
return nil
}
var _ Fielder = new(PositiveSmallIntegerField)
// 0 to 4294967295
@ -509,10 +473,6 @@ func (e *PositiveIntegerField) RawValue() interface{} {
return e.Value()
}
func (e *PositiveIntegerField) Clean() error {
return nil
}
var _ Fielder = new(PositiveIntegerField)
// 0 to 18446744073709551615
@ -553,10 +513,6 @@ func (e *PositiveBigIntegerField) RawValue() interface{} {
return e.Value()
}
func (e *PositiveBigIntegerField) Clean() error {
return nil
}
var _ Fielder = new(PositiveBigIntegerField)
// A large text field.
@ -592,8 +548,4 @@ func (e *TextField) RawValue() interface{} {
return e.Value()
}
func (e *TextField) Clean() error {
return nil
}
var _ Fielder = new(TextField)

View File

@ -128,10 +128,14 @@ func newFieldInfo(mi *modelInfo, field reflect.Value, sf reflect.StructField) (f
fi = new(fieldInfo)
if field.Kind() != reflect.Ptr && field.Kind() != reflect.Slice && field.CanAddr() {
addrField = field
if field.CanAddr() && field.Kind() != reflect.Ptr {
addrField = field.Addr()
} else {
addrField = field
if _, ok := addrField.Interface().(Fielder); !ok {
if field.Kind() == reflect.Slice {
addrField = field
}
}
}
parseStructTag(sf.Tag.Get(defaultStructTagName), &attrs, &tags)

View File

@ -16,7 +16,6 @@ type Fielder interface {
FieldType() int
SetRaw(interface{}) error
RawValue() interface{}
Clean() error
}
type Ormer interface {
@ -84,17 +83,6 @@ type RawSeter interface {
Prepare() (RawPreparer, error)
}
type IFieldError interface {
Name() string
Error() error
}
type IFieldErrors interface {
Get(string) IFieldError
Set(string, IFieldError)
List() []IFieldError
}
type stmtQuerier interface {
Close() error
Exec(args ...interface{}) (sql.Result, error)