valuer

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicTypeCreator

type BasicTypeCreator struct {
	Creator
}

BasicTypeCreator 支持基本类型的 Creator, 基于原生的 Creator 扩展

func (BasicTypeCreator) NewBasicTypeValue

func (c BasicTypeCreator) NewBasicTypeValue(val any, meta *model.TableMeta) Value

NewBasicTypeValue 返回一个封装好的,基于支持基本类型实现的 Value 输入 val 必须是一个指向结构体实例的指针,而不能是任何其它类型

type Creator

type Creator func(val any, meta *model.TableMeta) Value

type Value

type Value interface {
	// Field 访问结构体字段, name 是字段名
	Field(name string) (any, error)
	// SetColumns 设置新值,column 是列名
	// 要注意,val 可能存在被上层复用,从而引起篡改的问题
	SetColumns(rows *sql.Rows) error
}

Value 是对结构体实例的内部抽象

func NewReflectValue

func NewReflectValue(val interface{}, meta *model.TableMeta) Value

NewReflectValue 返回一个封装好的,基于反射实现的 Value 输入 val 必须是一个指向结构体实例的指针,而不能是任何其它类型

func NewUnsafeValue

func NewUnsafeValue(val interface{}, meta *model.TableMeta) Value

Jump to

Keyboard shortcuts

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