1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-14 18:10:55 +00:00
Beego/orm/models_fields.go

630 lines
14 KiB
Go
Raw Normal View History

2014-08-18 08:41:43 +00:00
// Copyright 2014 beego Author. All Rights Reserved.
2014-07-03 15:40:21 +00:00
//
2014-08-18 08:41:43 +00:00
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
2014-07-03 15:40:21 +00:00
//
2014-08-18 08:41:43 +00:00
// http://www.apache.org/licenses/LICENSE-2.0
2014-07-03 15:40:21 +00:00
//
2014-08-18 08:41:43 +00:00
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2013-07-30 12:32:38 +00:00
package orm
import (
"fmt"
"strconv"
"time"
)
2015-09-12 13:46:43 +00:00
// Define the Type enum
2013-07-30 12:32:38 +00:00
const (
TypeBooleanField = 1 << iota
TypeCharField
TypeTextField
TypeDateField
TypeDateTimeField
TypeBitField
2013-07-30 12:32:38 +00:00
TypeSmallIntegerField
TypeIntegerField
TypeBigIntegerField
2013-08-19 14:37:39 +00:00
TypePositiveBitField
2013-07-30 12:32:38 +00:00
TypePositiveSmallIntegerField
TypePositiveIntegerField
TypePositiveBigIntegerField
TypeFloatField
TypeDecimalField
RelForeignKey
RelOneToOne
RelManyToMany
RelReverseOne
RelReverseMany
)
2015-09-12 13:46:43 +00:00
// Define some logic enum
2013-07-30 12:32:38 +00:00
const (
IsIntegerField = ^-TypePositiveBigIntegerField >> 4 << 5
IsPostiveIntegerField = ^-TypePositiveBigIntegerField >> 8 << 9
IsRelField = ^-RelReverseMany >> 14 << 15
2013-07-30 12:32:38 +00:00
IsFieldType = ^-RelReverseMany<<1 + 1
)
2015-09-12 13:46:43 +00:00
// BooleanField A true/false field.
2013-07-30 12:32:38 +00:00
type BooleanField bool
2015-09-12 13:46:43 +00:00
// Value return the BooleanField
2013-07-30 12:32:38 +00:00
func (e BooleanField) Value() bool {
return bool(e)
}
2015-09-12 13:46:43 +00:00
// Set will set the BooleanField
2013-07-30 12:32:38 +00:00
func (e *BooleanField) Set(d bool) {
*e = BooleanField(d)
}
2015-09-12 13:46:43 +00:00
// String format the Bool to string
2013-07-30 12:32:38 +00:00
func (e *BooleanField) String() string {
return strconv.FormatBool(e.Value())
}
2015-09-12 13:46:43 +00:00
// FieldType return BooleanField the type
2013-07-30 12:32:38 +00:00
func (e *BooleanField) FieldType() int {
return TypeBooleanField
}
2015-09-12 13:46:43 +00:00
// SetRaw set the interface to bool
2013-07-30 12:32:38 +00:00
func (e *BooleanField) SetRaw(value interface{}) error {
switch d := value.(type) {
case bool:
e.Set(d)
case string:
v, err := StrTo(d).Bool()
if err != nil {
e.Set(v)
}
return err
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<BooleanField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return the current value
2013-07-30 12:32:38 +00:00
func (e *BooleanField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify the BooleanField implement the Fielder interface
2013-07-31 14:11:22 +00:00
var _ Fielder = new(BooleanField)
2015-09-12 13:46:43 +00:00
// CharField A string field
2013-07-31 14:11:22 +00:00
// required values tag: size
// The size is enforced at the database level and in modelss validation.
// eg: `orm:"size(120)"`
2013-07-30 12:32:38 +00:00
type CharField string
2015-09-12 13:46:43 +00:00
// Value return the CharField's Value
2013-07-30 12:32:38 +00:00
func (e CharField) Value() string {
return string(e)
}
2015-09-12 13:46:43 +00:00
// Set CharField value
2013-07-30 12:32:38 +00:00
func (e *CharField) Set(d string) {
*e = CharField(d)
}
2015-09-12 13:46:43 +00:00
// String return the CharField
2013-07-30 12:32:38 +00:00
func (e *CharField) String() string {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// FieldType return the enum type
2013-07-30 12:32:38 +00:00
func (e *CharField) FieldType() int {
return TypeCharField
}
2015-09-12 13:46:43 +00:00
// SetRaw set the interface to string
2013-07-30 12:32:38 +00:00
func (e *CharField) SetRaw(value interface{}) error {
switch d := value.(type) {
case string:
e.Set(d)
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<CharField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return the CharField value
2013-07-30 12:32:38 +00:00
func (e *CharField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify CharField implement Fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(CharField)
2015-09-12 13:46:43 +00:00
// DateField A date, represented in go by a time.Time instance.
2013-07-30 12:32:38 +00:00
// only date values like 2006-01-02
// Has a few extra, optional attr tag:
//
// auto_now:
// Automatically set the field to now every time the object is saved. Useful for “last-modified” timestamps.
// Note that the current date is always used; its not just a default value that you can override.
//
// auto_now_add:
// Automatically set the field to now when the object is first created. Useful for creation of timestamps.
// Note that the current date is always used; its not just a default value that you can override.
//
2013-07-31 14:11:22 +00:00
// eg: `orm:"auto_now"` or `orm:"auto_now_add"`
2013-07-30 12:32:38 +00:00
type DateField time.Time
2015-09-12 13:46:43 +00:00
// Value return the time.Time
2013-07-30 12:32:38 +00:00
func (e DateField) Value() time.Time {
return time.Time(e)
}
2015-09-12 13:46:43 +00:00
// Set set the DateField's value
2013-07-30 12:32:38 +00:00
func (e *DateField) Set(d time.Time) {
*e = DateField(d)
}
2015-09-12 13:46:43 +00:00
// String convert datatime to string
2013-07-30 12:32:38 +00:00
func (e *DateField) String() string {
return e.Value().String()
}
2015-09-12 13:46:43 +00:00
// FieldType return enum type Date
2013-07-30 12:32:38 +00:00
func (e *DateField) FieldType() int {
return TypeDateField
}
2015-09-12 13:46:43 +00:00
// SetRaw convert the interface to time.Time. Allow string and time.Time
2013-07-30 12:32:38 +00:00
func (e *DateField) SetRaw(value interface{}) error {
switch d := value.(type) {
case time.Time:
e.Set(d)
case string:
2015-09-12 13:46:43 +00:00
v, err := timeParse(d, formatDate)
2013-07-30 12:32:38 +00:00
if err != nil {
e.Set(v)
}
return err
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<DateField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return Date value
2013-07-30 12:32:38 +00:00
func (e *DateField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify DateField implement fielder interface
2013-07-31 14:11:22 +00:00
var _ Fielder = new(DateField)
2015-09-12 13:46:43 +00:00
// DateTimeField A date, represented in go by a time.Time instance.
2013-07-30 12:32:38 +00:00
// datetime values like 2006-01-02 15:04:05
// Takes the same extra arguments as DateField.
type DateTimeField time.Time
2015-09-12 13:46:43 +00:00
// Value return the datatime value
2013-07-30 12:32:38 +00:00
func (e DateTimeField) Value() time.Time {
return time.Time(e)
}
2015-09-12 13:46:43 +00:00
// Set set the time.Time to datatime
2013-07-30 12:32:38 +00:00
func (e *DateTimeField) Set(d time.Time) {
*e = DateTimeField(d)
}
2015-09-12 13:46:43 +00:00
// String return the time's String
2013-07-30 12:32:38 +00:00
func (e *DateTimeField) String() string {
return e.Value().String()
}
2015-09-12 13:46:43 +00:00
// FieldType return the enum TypeDateTimeField
2013-07-30 12:32:38 +00:00
func (e *DateTimeField) FieldType() int {
return TypeDateTimeField
}
2015-09-12 13:46:43 +00:00
// SetRaw convert the string or time.Time to DateTimeField
2013-07-30 12:32:38 +00:00
func (e *DateTimeField) SetRaw(value interface{}) error {
switch d := value.(type) {
case time.Time:
e.Set(d)
case string:
2015-09-12 13:46:43 +00:00
v, err := timeParse(d, formatDateTime)
2013-07-30 12:32:38 +00:00
if err != nil {
e.Set(v)
}
return err
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<DateTimeField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return the datatime value
2013-07-30 12:32:38 +00:00
func (e *DateTimeField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify datatime implement fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(DateTimeField)
2015-09-12 13:46:43 +00:00
// FloatField A floating-point number represented in go by a float32 value.
2013-07-30 12:32:38 +00:00
type FloatField float64
2015-09-12 13:46:43 +00:00
// Value return the FloatField value
2013-07-30 12:32:38 +00:00
func (e FloatField) Value() float64 {
return float64(e)
}
2015-09-12 13:46:43 +00:00
// Set the Float64
2013-07-30 12:32:38 +00:00
func (e *FloatField) Set(d float64) {
*e = FloatField(d)
}
2015-09-12 13:46:43 +00:00
// String return the string
2013-07-30 12:32:38 +00:00
func (e *FloatField) String() string {
return ToStr(e.Value(), -1, 32)
}
2015-09-12 13:46:43 +00:00
// FieldType return the enum type
2013-07-30 12:32:38 +00:00
func (e *FloatField) FieldType() int {
return TypeFloatField
}
2015-09-12 13:46:43 +00:00
// SetRaw converter interface Float64 float32 or string to FloatField
2013-07-30 12:32:38 +00:00
func (e *FloatField) SetRaw(value interface{}) error {
switch d := value.(type) {
case float32:
e.Set(float64(d))
case float64:
e.Set(d)
case string:
v, err := StrTo(d).Float64()
if err != nil {
e.Set(v)
}
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<FloatField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return the FloatField value
2013-07-30 12:32:38 +00:00
func (e *FloatField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify FloatField implement Fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(FloatField)
2015-09-12 13:46:43 +00:00
// SmallIntegerField -32768 to 32767
2013-07-30 12:32:38 +00:00
type SmallIntegerField int16
2015-09-12 13:46:43 +00:00
// Value return int16 value
2013-07-30 12:32:38 +00:00
func (e SmallIntegerField) Value() int16 {
return int16(e)
}
2015-09-12 13:46:43 +00:00
// Set the SmallIntegerField value
2013-07-30 12:32:38 +00:00
func (e *SmallIntegerField) Set(d int16) {
*e = SmallIntegerField(d)
}
2015-09-12 13:46:43 +00:00
// String convert smallint to string
2013-07-30 12:32:38 +00:00
func (e *SmallIntegerField) String() string {
return ToStr(e.Value())
}
2015-09-12 13:46:43 +00:00
// FieldType return enum type SmallIntegerField
2013-07-30 12:32:38 +00:00
func (e *SmallIntegerField) FieldType() int {
return TypeSmallIntegerField
}
2015-09-12 13:46:43 +00:00
// SetRaw convert interface int16/string to int16
2013-07-30 12:32:38 +00:00
func (e *SmallIntegerField) SetRaw(value interface{}) error {
switch d := value.(type) {
case int16:
e.Set(d)
case string:
v, err := StrTo(d).Int16()
if err != nil {
e.Set(v)
}
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<SmallIntegerField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return smallint value
2013-07-30 12:32:38 +00:00
func (e *SmallIntegerField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify SmallIntegerField implement Fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(SmallIntegerField)
2015-09-12 13:46:43 +00:00
// IntegerField -2147483648 to 2147483647
2013-07-30 12:32:38 +00:00
type IntegerField int32
2015-09-12 13:46:43 +00:00
// Value return the int32
2013-07-30 12:32:38 +00:00
func (e IntegerField) Value() int32 {
return int32(e)
}
2015-09-12 13:46:43 +00:00
// Set IntegerField value
2013-07-30 12:32:38 +00:00
func (e *IntegerField) Set(d int32) {
*e = IntegerField(d)
}
2015-09-12 13:46:43 +00:00
// String convert Int32 to string
2013-07-30 12:32:38 +00:00
func (e *IntegerField) String() string {
return ToStr(e.Value())
}
2015-09-12 13:46:43 +00:00
// FieldType return the enum type
2013-07-30 12:32:38 +00:00
func (e *IntegerField) FieldType() int {
return TypeIntegerField
}
2015-09-12 13:46:43 +00:00
// SetRaw convert interface int32/string to int32
2013-07-30 12:32:38 +00:00
func (e *IntegerField) SetRaw(value interface{}) error {
switch d := value.(type) {
case int32:
e.Set(d)
case string:
v, err := StrTo(d).Int32()
if err != nil {
e.Set(v)
}
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<IntegerField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return IntegerField value
2013-07-30 12:32:38 +00:00
func (e *IntegerField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify IntegerField implement Fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(IntegerField)
2015-09-12 13:46:43 +00:00
// BigIntegerField -9223372036854775808 to 9223372036854775807.
2013-07-30 12:32:38 +00:00
type BigIntegerField int64
2015-09-12 13:46:43 +00:00
// Value return int64
2013-07-30 12:32:38 +00:00
func (e BigIntegerField) Value() int64 {
return int64(e)
}
2015-09-12 13:46:43 +00:00
// Set the BigIntegerField value
2013-07-30 12:32:38 +00:00
func (e *BigIntegerField) Set(d int64) {
*e = BigIntegerField(d)
}
2015-09-12 13:46:43 +00:00
// String convert BigIntegerField to string
2013-07-30 12:32:38 +00:00
func (e *BigIntegerField) String() string {
return ToStr(e.Value())
}
2015-09-12 13:46:43 +00:00
// FieldType return enum type
2013-07-30 12:32:38 +00:00
func (e *BigIntegerField) FieldType() int {
return TypeBigIntegerField
}
2015-09-12 13:46:43 +00:00
// SetRaw convert interface int64/string to int64
2013-07-30 12:32:38 +00:00
func (e *BigIntegerField) SetRaw(value interface{}) error {
switch d := value.(type) {
case int64:
e.Set(d)
case string:
v, err := StrTo(d).Int64()
if err != nil {
e.Set(v)
}
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<BigIntegerField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return BigIntegerField value
2013-07-30 12:32:38 +00:00
func (e *BigIntegerField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify BigIntegerField implement Fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(BigIntegerField)
2015-09-12 13:46:43 +00:00
// PositiveSmallIntegerField 0 to 65535
2013-07-30 12:32:38 +00:00
type PositiveSmallIntegerField uint16
2015-09-12 13:46:43 +00:00
// Value return uint16
2013-07-30 12:32:38 +00:00
func (e PositiveSmallIntegerField) Value() uint16 {
return uint16(e)
}
2015-09-12 13:46:43 +00:00
// Set PositiveSmallIntegerField value
2013-07-30 12:32:38 +00:00
func (e *PositiveSmallIntegerField) Set(d uint16) {
*e = PositiveSmallIntegerField(d)
}
2015-09-12 13:46:43 +00:00
// String convert uint16 to string
2013-07-30 12:32:38 +00:00
func (e *PositiveSmallIntegerField) String() string {
return ToStr(e.Value())
}
2015-09-12 13:46:43 +00:00
// FieldType return enum type
2013-07-30 12:32:38 +00:00
func (e *PositiveSmallIntegerField) FieldType() int {
return TypePositiveSmallIntegerField
}
2015-09-12 13:46:43 +00:00
// SetRaw convert Interface uint16/string to uint16
2013-07-30 12:32:38 +00:00
func (e *PositiveSmallIntegerField) SetRaw(value interface{}) error {
switch d := value.(type) {
case uint16:
e.Set(d)
case string:
v, err := StrTo(d).Uint16()
if err != nil {
e.Set(v)
}
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<PositiveSmallIntegerField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue returns PositiveSmallIntegerField value
2013-07-30 12:32:38 +00:00
func (e *PositiveSmallIntegerField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify PositiveSmallIntegerField implement Fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(PositiveSmallIntegerField)
2015-09-12 13:46:43 +00:00
// PositiveIntegerField 0 to 4294967295
2013-07-30 12:32:38 +00:00
type PositiveIntegerField uint32
2015-09-12 13:46:43 +00:00
// Value return PositiveIntegerField value. Uint32
2013-07-30 12:32:38 +00:00
func (e PositiveIntegerField) Value() uint32 {
return uint32(e)
}
2015-09-12 13:46:43 +00:00
// Set the PositiveIntegerField value
2013-07-30 12:32:38 +00:00
func (e *PositiveIntegerField) Set(d uint32) {
*e = PositiveIntegerField(d)
}
2015-09-12 13:46:43 +00:00
// String convert PositiveIntegerField to string
2013-07-30 12:32:38 +00:00
func (e *PositiveIntegerField) String() string {
return ToStr(e.Value())
}
2015-09-12 13:46:43 +00:00
// FieldType return enum type
2013-07-30 12:32:38 +00:00
func (e *PositiveIntegerField) FieldType() int {
return TypePositiveIntegerField
}
2015-09-12 13:46:43 +00:00
// SetRaw convert interface uint32/string to Uint32
2013-07-30 12:32:38 +00:00
func (e *PositiveIntegerField) SetRaw(value interface{}) error {
switch d := value.(type) {
case uint32:
e.Set(d)
case string:
v, err := StrTo(d).Uint32()
if err != nil {
e.Set(v)
}
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<PositiveIntegerField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return the PositiveIntegerField Value
2013-07-30 12:32:38 +00:00
func (e *PositiveIntegerField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify PositiveIntegerField implement Fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(PositiveIntegerField)
2015-09-12 13:46:43 +00:00
// PositiveBigIntegerField 0 to 18446744073709551615
2013-07-30 12:32:38 +00:00
type PositiveBigIntegerField uint64
2015-09-12 13:46:43 +00:00
// Value return uint64
2013-07-30 12:32:38 +00:00
func (e PositiveBigIntegerField) Value() uint64 {
return uint64(e)
}
2015-09-12 13:46:43 +00:00
// Set PositiveBigIntegerField value
2013-07-30 12:32:38 +00:00
func (e *PositiveBigIntegerField) Set(d uint64) {
*e = PositiveBigIntegerField(d)
}
2015-09-12 13:46:43 +00:00
// String convert PositiveBigIntegerField to string
2013-07-30 12:32:38 +00:00
func (e *PositiveBigIntegerField) String() string {
return ToStr(e.Value())
}
2015-09-12 13:46:43 +00:00
// FieldType return enum type
2013-07-30 12:32:38 +00:00
func (e *PositiveBigIntegerField) FieldType() int {
return TypePositiveIntegerField
}
2015-09-12 13:46:43 +00:00
// SetRaw convert interface uint64/string to Uint64
2013-07-30 12:32:38 +00:00
func (e *PositiveBigIntegerField) SetRaw(value interface{}) error {
switch d := value.(type) {
case uint64:
e.Set(d)
case string:
v, err := StrTo(d).Uint64()
if err != nil {
e.Set(v)
}
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<PositiveBigIntegerField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return PositiveBigIntegerField value
2013-07-30 12:32:38 +00:00
func (e *PositiveBigIntegerField) RawValue() interface{} {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// verify PositiveBigIntegerField implement Fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(PositiveBigIntegerField)
2015-09-12 13:46:43 +00:00
// TextField A large text field.
2013-07-30 12:32:38 +00:00
type TextField string
2015-09-12 13:46:43 +00:00
// Value return TextField value
2013-07-30 12:32:38 +00:00
func (e TextField) Value() string {
return string(e)
}
2015-09-12 13:46:43 +00:00
// Set the TextField value
2013-07-30 12:32:38 +00:00
func (e *TextField) Set(d string) {
*e = TextField(d)
}
2015-09-12 13:46:43 +00:00
// String convert TextField to string
2013-07-30 12:32:38 +00:00
func (e *TextField) String() string {
return e.Value()
}
2015-09-12 13:46:43 +00:00
// FieldType return enum type
2013-07-30 12:32:38 +00:00
func (e *TextField) FieldType() int {
return TypeTextField
}
2015-09-12 13:46:43 +00:00
// SetRaw convert interface string to string
2013-07-30 12:32:38 +00:00
func (e *TextField) SetRaw(value interface{}) error {
switch d := value.(type) {
case string:
e.Set(d)
default:
2015-09-12 13:46:43 +00:00
return fmt.Errorf("<TextField.SetRaw> unknown value `%s`", value)
2013-07-30 12:32:38 +00:00
}
return nil
}
2015-09-12 13:46:43 +00:00
// RawValue return TextField value
2013-07-30 12:32:38 +00:00
func (e *TextField) RawValue() interface{} {
return e.Value()
}
2013-07-31 14:11:22 +00:00
2015-09-12 13:46:43 +00:00
// verify TextField implement Fielder
2013-07-31 14:11:22 +00:00
var _ Fielder = new(TextField)