field

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Int16

type Int16 struct {
	IntStorage[int16]
	IntBuilder[int16]
}

type Int32

type Int32 struct {
	IntStorage[int32]
	IntBuilder[int32]
}

type Int64

type Int64 struct {
	IntStorage[int64]
	IntBuilder[int64]
}

type IntBuilder

type IntBuilder[T any] struct {
	// contains filtered or unexported fields
}

func (*IntBuilder[T]) AttrType

func (i *IntBuilder[T]) AttrType(dbType dialect.DbDriver) string

func (*IntBuilder[T]) Comment

func (i *IntBuilder[T]) Comment(comment string) *IntBuilder[T]

设置字段的注释。

func (*IntBuilder[T]) Default

func (i *IntBuilder[T]) Default(value int16) *IntBuilder[T]

设置字段的默认值。 如果设置了默认值,则在插入数据时,如果没有设置字段的值,则会使用默认值。

func (*IntBuilder[T]) Descriptor

func (i *IntBuilder[T]) Descriptor() *entity.Descriptor

func (*IntBuilder[T]) Init

func (i *IntBuilder[T]) Init(desc *entity.Descriptor) error

func (*IntBuilder[T]) MinLen

func (i *IntBuilder[T]) MinLen(size int) *IntBuilder[T]

设置字段的最小长度。

func (*IntBuilder[T]) Name

func (i *IntBuilder[T]) Name(name string) *IntBuilder[T]

func (*IntBuilder[T]) Primary

func (i *IntBuilder[T]) Primary(index int) *IntBuilder[T]

设置字段为主键。 index: 主键的索引,从1开始,对于多个主键,需要设置不同大小的索引。

func (*IntBuilder[T]) Required

func (i *IntBuilder[T]) Required() *IntBuilder[T]

是否非空,默认可以为null,如果调用[Required],则字段为非空字段。

func (*IntBuilder[T]) Sequence

func (i *IntBuilder[T]) Sequence(s entity.Sequence) *IntBuilder[T]

设置字段的序列。 如果序列不存在,则会自动创建序列。 优先级高于[Default]。

func (*IntBuilder[T]) ValueType

func (i *IntBuilder[T]) ValueType() string

type IntStorage

type IntStorage[T any] struct {
	// contains filtered or unexported fields
}

func (*IntStorage[T]) Get

func (i *IntStorage[T]) Get() *T

func (*IntStorage[T]) Scan

func (i *IntStorage[T]) Scan(value interface{}) error

func (*IntStorage[T]) Set

func (i *IntStorage[T]) Set(value T) error

func (IntStorage[T]) String

func (i IntStorage[T]) String() string

func (*IntStorage[T]) Value

func (i *IntStorage[T]) Value() entity.FieldValue

type RawBytes

type RawBytes []byte

type Scanner

type Scanner interface {
	// Scan assigns a value from a database driver.
	//
	// The src value will be of one of the following types:
	//
	//    int64
	//    float64
	//    bool
	//    []bytetaurus_go/entity/field/field.go
	//    string
	//    time.Time
	//    nil - for NULL values
	//
	// An error should be returned if the value cannot be stored
	// without loss of information.
	//
	// Reference types such as []byte are only valid until the next call to Scan
	// and should not be retained. Their underlying memory is owned by the driver.
	// If retention is necessary, copy their values before the next call to Scan.
	Scan(src any) error
}

Scanner is an interface used by Scan.

type String

type String struct {
	StringBuilder
	StringStorage
}

type StringBuilder

type StringBuilder struct {
	// contains filtered or unexported fields
}

func (*StringBuilder) AttrType

func (s *StringBuilder) AttrType(dbType dialect.DbDriver) string

func (*StringBuilder) Comment

func (s *StringBuilder) Comment(comment string) *StringBuilder

设置字段的注释。

func (*StringBuilder) Default

func (s *StringBuilder) Default(value string) *StringBuilder

设置字段的默认值。 如果设置了默认值,则在插入数据时,如果没有设置字段的值,则会使用默认值。

func (*StringBuilder) Descriptor

func (s *StringBuilder) Descriptor() *entity.Descriptor

func (*StringBuilder) Init

func (s *StringBuilder) Init(desc *entity.Descriptor) error

func (*StringBuilder) MaxLen

func (s *StringBuilder) MaxLen(i int64) *StringBuilder

设置字段的最大长度。

func (*StringBuilder) MinLen

func (s *StringBuilder) MinLen(i int) *StringBuilder

设置字段的最小长度。

func (*StringBuilder) Name

func (s *StringBuilder) Name(name string) *StringBuilder

func (*StringBuilder) Primary

func (s *StringBuilder) Primary(index int) *StringBuilder

设置字段为主键。 index: 主键的索引,从1开始,对于多个主键,需要设置不同大小的索引。

func (*StringBuilder) Required

func (s *StringBuilder) Required() *StringBuilder

是否非空,默认可以为null,如果调用[Required],则字段为非空字段。

func (*StringBuilder) ValueType

func (s *StringBuilder) ValueType() string

type StringStorage

type StringStorage struct {
	// contains filtered or unexported fields
}

func (*StringStorage) Get

func (i *StringStorage) Get() *string

func (*StringStorage) Scan

func (s *StringStorage) Scan(value any) error

func (*StringStorage) Set

func (i *StringStorage) Set(value string) error

func (StringStorage) String

func (s StringStorage) String() string

func (*StringStorage) Value

func (s *StringStorage) Value() entity.FieldValue

type TimestampStorage

type TimestampStorage struct {
	// contains filtered or unexported fields
}

func (*TimestampStorage) Get

func (t *TimestampStorage) Get() *time.Time

func (*TimestampStorage) Scan

func (t *TimestampStorage) Scan(value interface{}) error

func (*TimestampStorage) Set

func (t *TimestampStorage) Set(value time.Time) error

func (TimestampStorage) String

func (t TimestampStorage) String() string

func (*TimestampStorage) Value

func (t *TimestampStorage) Value() entity.FieldValue

type Timestamptz

type Timestamptz struct {
	TimestamptzBuilder
	TimestampStorage
}

type TimestamptzBuilder

type TimestamptzBuilder struct {
	// contains filtered or unexported fields
}

func (*TimestamptzBuilder) AttrType

func (t *TimestamptzBuilder) AttrType(dbType dialect.DbDriver) string

func (*TimestamptzBuilder) Comment

func (t *TimestamptzBuilder) Comment(comment string) *TimestamptzBuilder

设置字段的注释。

func (*TimestamptzBuilder) Default

func (t *TimestamptzBuilder) Default(value string) *TimestamptzBuilder

设置字段的默认值。 如果设置了默认值,则在插入数据时,如果没有设置字段的值,则会使用默认值。

func (*TimestamptzBuilder) Descriptor

func (t *TimestamptzBuilder) Descriptor() *entity.Descriptor

func (*TimestamptzBuilder) Init

func (t *TimestamptzBuilder) Init(desc *entity.Descriptor) error

func (*TimestamptzBuilder) MinLen

func (t *TimestamptzBuilder) MinLen(size int) *TimestamptzBuilder

设置字段的最小长度。

func (*TimestamptzBuilder) Name

func (*TimestamptzBuilder) Precision

func (t *TimestamptzBuilder) Precision(precision int) *TimestamptzBuilder

func (*TimestamptzBuilder) Primary

func (t *TimestamptzBuilder) Primary(index int) *TimestamptzBuilder

func (*TimestamptzBuilder) Required

func (t *TimestamptzBuilder) Required() *TimestamptzBuilder

func (*TimestamptzBuilder) ValueType

func (t *TimestamptzBuilder) ValueType() string

type UUID

type UUID struct {
	UUIDBuilder
	StringStorage
}

func (*UUID) Comment

func (u *UUID) Comment(comment string) *UUID

func (*UUID) Default

func (u *UUID) Default(value string) *UUID

func (*UUID) MinLen

func (u *UUID) MinLen(i int) *UUID

func (*UUID) Name

func (u *UUID) Name(name string) *UUID

func (*UUID) Primary

func (u *UUID) Primary(index int) *UUID

func (*UUID) Required

func (u *UUID) Required() *UUID

func (*UUID) ValueType

func (s *UUID) ValueType() string

type UUIDBuilder

type UUIDBuilder struct {
	// contains filtered or unexported fields
}

func (*UUIDBuilder) AttrType

func (u *UUIDBuilder) AttrType(dbType dialect.DbDriver) string

func (*UUIDBuilder) Descriptor

func (u *UUIDBuilder) Descriptor() *entity.Descriptor

func (*UUIDBuilder) Init

func (u *UUIDBuilder) Init(desc *entity.Descriptor) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL