2020-07-15 02:04:22 +00:00
|
|
|
|
// Copyright 2014 beego Author. All Rights Reserved.
|
|
|
|
|
//
|
|
|
|
|
// 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
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
|
|
package orm
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
2020-12-12 13:28:58 +00:00
|
|
|
|
|
|
|
|
|
"github.com/astaxie/beego/client/orm"
|
2020-07-15 02:04:22 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Define the Type enum
|
|
|
|
|
const (
|
2020-12-12 13:28:58 +00:00
|
|
|
|
TypeBooleanField = orm.TypeBooleanField
|
|
|
|
|
TypeVarCharField = orm.TypeVarCharField
|
|
|
|
|
TypeCharField = orm.TypeCharField
|
|
|
|
|
TypeTextField = orm.TypeTextField
|
|
|
|
|
TypeTimeField = orm.TypeTimeField
|
|
|
|
|
TypeDateField = orm.TypeDateField
|
|
|
|
|
TypeDateTimeField = orm.TypeDateTimeField
|
|
|
|
|
TypeBitField = orm.TypeBitField
|
|
|
|
|
TypeSmallIntegerField = orm.TypeSmallIntegerField
|
|
|
|
|
TypeIntegerField = orm.TypeIntegerField
|
|
|
|
|
TypeBigIntegerField = orm.TypeBigIntegerField
|
|
|
|
|
TypePositiveBitField = orm.TypePositiveBitField
|
|
|
|
|
TypePositiveSmallIntegerField = orm.TypePositiveSmallIntegerField
|
|
|
|
|
TypePositiveIntegerField = orm.TypePositiveIntegerField
|
|
|
|
|
TypePositiveBigIntegerField = orm.TypePositiveBigIntegerField
|
|
|
|
|
TypeFloatField = orm.TypeFloatField
|
|
|
|
|
TypeDecimalField = orm.TypeDecimalField
|
|
|
|
|
TypeJSONField = orm.TypeJSONField
|
|
|
|
|
TypeJsonbField = orm.TypeJsonbField
|
|
|
|
|
RelForeignKey = orm.RelForeignKey
|
|
|
|
|
RelOneToOne = orm.RelOneToOne
|
|
|
|
|
RelManyToMany = orm.RelManyToMany
|
|
|
|
|
RelReverseOne = orm.RelReverseOne
|
|
|
|
|
RelReverseMany = orm.RelReverseMany
|
2020-07-15 02:04:22 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Define some logic enum
|
|
|
|
|
const (
|
2020-12-12 13:28:58 +00:00
|
|
|
|
IsIntegerField = orm.IsIntegerField
|
|
|
|
|
IsPositiveIntegerField = orm.IsPositiveIntegerField
|
|
|
|
|
IsRelField = orm.IsRelField
|
|
|
|
|
IsFieldType = orm.IsFieldType
|
2020-07-15 02:04:22 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// BooleanField A true/false field.
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type BooleanField orm.BooleanField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return the BooleanField
|
|
|
|
|
func (e BooleanField) Value() bool {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.BooleanField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set will set the BooleanField
|
|
|
|
|
func (e *BooleanField) Set(d bool) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.BooleanField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String format the Bool to string
|
|
|
|
|
func (e *BooleanField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.BooleanField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return BooleanField the type
|
|
|
|
|
func (e *BooleanField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.BooleanField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw set the interface to bool
|
|
|
|
|
func (e *BooleanField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.BooleanField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return the current value
|
|
|
|
|
func (e *BooleanField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.BooleanField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify the BooleanField implement the Fielder interface
|
|
|
|
|
var _ Fielder = new(BooleanField)
|
|
|
|
|
|
|
|
|
|
// CharField A string field
|
|
|
|
|
// required values tag: size
|
|
|
|
|
// The size is enforced at the database level and in models’s validation.
|
|
|
|
|
// eg: `orm:"size(120)"`
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type CharField orm.CharField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return the CharField's Value
|
|
|
|
|
func (e CharField) Value() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.CharField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set CharField value
|
|
|
|
|
func (e *CharField) Set(d string) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.CharField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String return the CharField
|
|
|
|
|
func (e *CharField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.CharField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return the enum type
|
|
|
|
|
func (e *CharField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.CharField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw set the interface to string
|
|
|
|
|
func (e *CharField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.CharField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return the CharField value
|
|
|
|
|
func (e *CharField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.CharField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify CharField implement Fielder
|
|
|
|
|
var _ Fielder = new(CharField)
|
|
|
|
|
|
|
|
|
|
// TimeField A time, represented in go by a time.Time instance.
|
|
|
|
|
// only time values like 10:00:00
|
|
|
|
|
// 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; it’s 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; it’s not just a default value that you can override.
|
|
|
|
|
//
|
|
|
|
|
// eg: `orm:"auto_now"` or `orm:"auto_now_add"`
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type TimeField orm.TimeField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return the time.Time
|
|
|
|
|
func (e TimeField) Value() time.Time {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.TimeField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set set the TimeField's value
|
|
|
|
|
func (e *TimeField) Set(d time.Time) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.TimeField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert time to string
|
|
|
|
|
func (e *TimeField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.TimeField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type Date
|
|
|
|
|
func (e *TimeField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.TimeField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert the interface to time.Time. Allow string and time.Time
|
|
|
|
|
func (e *TimeField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.TimeField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return time value
|
|
|
|
|
func (e *TimeField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.TimeField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _ Fielder = new(TimeField)
|
|
|
|
|
|
|
|
|
|
// DateField A date, represented in go by a time.Time instance.
|
|
|
|
|
// 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; it’s 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; it’s not just a default value that you can override.
|
|
|
|
|
//
|
|
|
|
|
// eg: `orm:"auto_now"` or `orm:"auto_now_add"`
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type DateField orm.DateField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return the time.Time
|
|
|
|
|
func (e DateField) Value() time.Time {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.DateField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set set the DateField's value
|
|
|
|
|
func (e *DateField) Set(d time.Time) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.DateField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert datetime to string
|
|
|
|
|
func (e *DateField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.DateField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type Date
|
|
|
|
|
func (e *DateField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.DateField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert the interface to time.Time. Allow string and time.Time
|
|
|
|
|
func (e *DateField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.DateField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return Date value
|
|
|
|
|
func (e *DateField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.DateField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify DateField implement fielder interface
|
|
|
|
|
var _ Fielder = new(DateField)
|
|
|
|
|
|
|
|
|
|
// DateTimeField A date, represented in go by a time.Time instance.
|
|
|
|
|
// datetime values like 2006-01-02 15:04:05
|
|
|
|
|
// Takes the same extra arguments as DateField.
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type DateTimeField orm.DateTimeField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return the datetime value
|
|
|
|
|
func (e DateTimeField) Value() time.Time {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.DateTimeField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set set the time.Time to datetime
|
|
|
|
|
func (e *DateTimeField) Set(d time.Time) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.DateTimeField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String return the time's String
|
|
|
|
|
func (e *DateTimeField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.DateTimeField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return the enum TypeDateTimeField
|
|
|
|
|
func (e *DateTimeField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.DateTimeField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert the string or time.Time to DateTimeField
|
|
|
|
|
func (e *DateTimeField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.DateTimeField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return the datetime value
|
|
|
|
|
func (e *DateTimeField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.DateTimeField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify datetime implement fielder
|
|
|
|
|
var _ Fielder = new(DateTimeField)
|
|
|
|
|
|
|
|
|
|
// FloatField A floating-point number represented in go by a float32 value.
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type FloatField orm.FloatField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return the FloatField value
|
|
|
|
|
func (e FloatField) Value() float64 {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.FloatField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the Float64
|
|
|
|
|
func (e *FloatField) Set(d float64) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.FloatField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String return the string
|
|
|
|
|
func (e *FloatField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.FloatField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return the enum type
|
|
|
|
|
func (e *FloatField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.FloatField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw converter interface Float64 float32 or string to FloatField
|
|
|
|
|
func (e *FloatField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.FloatField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return the FloatField value
|
|
|
|
|
func (e *FloatField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.FloatField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify FloatField implement Fielder
|
|
|
|
|
var _ Fielder = new(FloatField)
|
|
|
|
|
|
|
|
|
|
// SmallIntegerField -32768 to 32767
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type SmallIntegerField orm.SmallIntegerField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return int16 value
|
|
|
|
|
func (e SmallIntegerField) Value() int16 {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.SmallIntegerField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the SmallIntegerField value
|
|
|
|
|
func (e *SmallIntegerField) Set(d int16) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.SmallIntegerField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert smallint to string
|
|
|
|
|
func (e *SmallIntegerField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.SmallIntegerField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type SmallIntegerField
|
|
|
|
|
func (e *SmallIntegerField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.SmallIntegerField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert interface int16/string to int16
|
|
|
|
|
func (e *SmallIntegerField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.SmallIntegerField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return smallint value
|
|
|
|
|
func (e *SmallIntegerField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.SmallIntegerField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify SmallIntegerField implement Fielder
|
|
|
|
|
var _ Fielder = new(SmallIntegerField)
|
|
|
|
|
|
|
|
|
|
// IntegerField -2147483648 to 2147483647
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type IntegerField orm.IntegerField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return the int32
|
|
|
|
|
func (e IntegerField) Value() int32 {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.IntegerField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set IntegerField value
|
|
|
|
|
func (e *IntegerField) Set(d int32) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.IntegerField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert Int32 to string
|
|
|
|
|
func (e *IntegerField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.IntegerField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return the enum type
|
|
|
|
|
func (e *IntegerField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.IntegerField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert interface int32/string to int32
|
|
|
|
|
func (e *IntegerField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.IntegerField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return IntegerField value
|
|
|
|
|
func (e *IntegerField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.IntegerField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify IntegerField implement Fielder
|
|
|
|
|
var _ Fielder = new(IntegerField)
|
|
|
|
|
|
|
|
|
|
// BigIntegerField -9223372036854775808 to 9223372036854775807.
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type BigIntegerField orm.BigIntegerField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return int64
|
|
|
|
|
func (e BigIntegerField) Value() int64 {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.BigIntegerField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the BigIntegerField value
|
|
|
|
|
func (e *BigIntegerField) Set(d int64) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.BigIntegerField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert BigIntegerField to string
|
|
|
|
|
func (e *BigIntegerField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.BigIntegerField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type
|
|
|
|
|
func (e *BigIntegerField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.BigIntegerField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert interface int64/string to int64
|
|
|
|
|
func (e *BigIntegerField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.BigIntegerField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return BigIntegerField value
|
|
|
|
|
func (e *BigIntegerField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.BigIntegerField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify BigIntegerField implement Fielder
|
|
|
|
|
var _ Fielder = new(BigIntegerField)
|
|
|
|
|
|
|
|
|
|
// PositiveSmallIntegerField 0 to 65535
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type PositiveSmallIntegerField orm.PositiveSmallIntegerField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return uint16
|
|
|
|
|
func (e PositiveSmallIntegerField) Value() uint16 {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.PositiveSmallIntegerField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set PositiveSmallIntegerField value
|
|
|
|
|
func (e *PositiveSmallIntegerField) Set(d uint16) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.PositiveSmallIntegerField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert uint16 to string
|
|
|
|
|
func (e *PositiveSmallIntegerField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveSmallIntegerField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type
|
|
|
|
|
func (e *PositiveSmallIntegerField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveSmallIntegerField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert Interface uint16/string to uint16
|
|
|
|
|
func (e *PositiveSmallIntegerField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveSmallIntegerField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue returns PositiveSmallIntegerField value
|
|
|
|
|
func (e *PositiveSmallIntegerField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveSmallIntegerField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify PositiveSmallIntegerField implement Fielder
|
|
|
|
|
var _ Fielder = new(PositiveSmallIntegerField)
|
|
|
|
|
|
|
|
|
|
// PositiveIntegerField 0 to 4294967295
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type PositiveIntegerField orm.PositiveIntegerField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return PositiveIntegerField value. Uint32
|
|
|
|
|
func (e PositiveIntegerField) Value() uint32 {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.PositiveIntegerField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the PositiveIntegerField value
|
|
|
|
|
func (e *PositiveIntegerField) Set(d uint32) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.PositiveIntegerField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert PositiveIntegerField to string
|
|
|
|
|
func (e *PositiveIntegerField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveIntegerField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type
|
|
|
|
|
func (e *PositiveIntegerField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveIntegerField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert interface uint32/string to Uint32
|
|
|
|
|
func (e *PositiveIntegerField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveIntegerField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return the PositiveIntegerField Value
|
|
|
|
|
func (e *PositiveIntegerField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveIntegerField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify PositiveIntegerField implement Fielder
|
|
|
|
|
var _ Fielder = new(PositiveIntegerField)
|
|
|
|
|
|
|
|
|
|
// PositiveBigIntegerField 0 to 18446744073709551615
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type PositiveBigIntegerField orm.PositiveBigIntegerField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return uint64
|
|
|
|
|
func (e PositiveBigIntegerField) Value() uint64 {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.PositiveBigIntegerField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set PositiveBigIntegerField value
|
|
|
|
|
func (e *PositiveBigIntegerField) Set(d uint64) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.PositiveBigIntegerField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert PositiveBigIntegerField to string
|
|
|
|
|
func (e *PositiveBigIntegerField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveBigIntegerField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type
|
|
|
|
|
func (e *PositiveBigIntegerField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveBigIntegerField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert interface uint64/string to Uint64
|
|
|
|
|
func (e *PositiveBigIntegerField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveBigIntegerField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return PositiveBigIntegerField value
|
|
|
|
|
func (e *PositiveBigIntegerField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.PositiveBigIntegerField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify PositiveBigIntegerField implement Fielder
|
|
|
|
|
var _ Fielder = new(PositiveBigIntegerField)
|
|
|
|
|
|
|
|
|
|
// TextField A large text field.
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type TextField orm.TextField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return TextField value
|
|
|
|
|
func (e TextField) Value() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.TextField(e).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the TextField value
|
|
|
|
|
func (e *TextField) Set(d string) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.TextField)(e).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert TextField to string
|
|
|
|
|
func (e *TextField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.TextField)(e).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type
|
|
|
|
|
func (e *TextField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.TextField)(e).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert interface string to string
|
|
|
|
|
func (e *TextField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.TextField)(e).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return TextField value
|
|
|
|
|
func (e *TextField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.TextField)(e).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify TextField implement Fielder
|
|
|
|
|
var _ Fielder = new(TextField)
|
|
|
|
|
|
|
|
|
|
// JSONField postgres json field.
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type JSONField orm.JSONField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return JSONField value
|
|
|
|
|
func (j JSONField) Value() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.JSONField(j).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the JSONField value
|
|
|
|
|
func (j *JSONField) Set(d string) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.JSONField)(j).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert JSONField to string
|
|
|
|
|
func (j *JSONField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.JSONField)(j).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type
|
|
|
|
|
func (j *JSONField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.JSONField)(j).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert interface string to string
|
|
|
|
|
func (j *JSONField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.JSONField)(j).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return JSONField value
|
|
|
|
|
func (j *JSONField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.JSONField)(j).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify JSONField implement Fielder
|
|
|
|
|
var _ Fielder = new(JSONField)
|
|
|
|
|
|
|
|
|
|
// JsonbField postgres json field.
|
2020-12-12 13:28:58 +00:00
|
|
|
|
type JsonbField orm.JsonbField
|
2020-07-15 02:04:22 +00:00
|
|
|
|
|
|
|
|
|
// Value return JsonbField value
|
|
|
|
|
func (j JsonbField) Value() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return orm.JsonbField(j).Value()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the JsonbField value
|
|
|
|
|
func (j *JsonbField) Set(d string) {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
(*orm.JsonbField)(j).Set(d)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String convert JsonbField to string
|
|
|
|
|
func (j *JsonbField) String() string {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.JsonbField)(j).String()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldType return enum type
|
|
|
|
|
func (j *JsonbField) FieldType() int {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.JsonbField)(j).FieldType()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetRaw convert interface string to string
|
|
|
|
|
func (j *JsonbField) SetRaw(value interface{}) error {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.JsonbField)(j).SetRaw(value)
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RawValue return JsonbField value
|
|
|
|
|
func (j *JsonbField) RawValue() interface{} {
|
2020-12-12 13:28:58 +00:00
|
|
|
|
return (*orm.JsonbField)(j).RawValue()
|
2020-07-15 02:04:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify JsonbField implement Fielder
|
|
|
|
|
var _ Fielder = new(JsonbField)
|