Documentation ¶
Index ¶
- func BuildTable(obj reflect.Value, t *Table) error
- func FindTableTag(typ reflect.Type, index int, t *Table) bool
- func GetActualResourceKey(key string) string
- func New(client *dbmysql.DB, codec runtime.Codec, version string) *store
- func UpdateNameWithResouceKey(obj runtime.Object, name string) error
- func WithTable(parent context.Context, val interface{}) context.Context
- type APIObjectVersioner
- func (a APIObjectVersioner) ObjectResourceVersion(obj runtime.Object) (uint64, error)
- func (a APIObjectVersioner) UpdateList(obj runtime.Object, resourceVersion uint64) error
- func (a APIObjectVersioner) UpdateObject(obj runtime.Object, resourceVersion uint64) error
- func (a APIObjectVersioner) UpdateTypeMeta(obj runtime.Object, kind string, version string) error
- type AfterFindTable
- type RowResult
- type Table
- func (t *Table) BaseCondition(dbHandle *gorm.DB, p storage.SelectionPredicate, selectionFeild []string) *gorm.DB
- func (t *Table) ConvertFieldsValue(value string) (sqlValue string)
- func (t *Table) CovertRowsToObject(row *RowResult, obj runtime.Object, table reflect.Value) error
- func (t *Table) ExtractTableObj(obj runtime.Object, afterFunc AfterFindTable) error
- func (t *Table) Fields(dbHandle *gorm.DB, p storage.SelectionPredicate, selectionFeild []string) *gorm.DB
- func (t *Table) GetColumnByField(filed string) (column string)
- func (t *Table) ObjMapField(obj reflect.Value, field []string, ignoreConstField bool) map[string]interface{}
- func (t *Table) ObjSelectField(tableObj reflect.Value) []interface{}
- func (t *Table) PageCondition(dbHandle *gorm.DB, p storage.SelectionPredicate, totalCount uint64) *gorm.DB
- func (t *Table) SetTable(obj runtime.Object, table reflect.Value) (string, error)
- type TableTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTable ¶
BuildTable search tag in obj return the reflect.value of tag return error if has a error
func FindTableTag ¶
FindTableTag scan object field,extract it into TableTag
func GetActualResourceKey ¶
func UpdateNameWithResouceKey ¶
UpdateNameWithResouceKey implements metadata.name
Types ¶
type APIObjectVersioner ¶
type APIObjectVersioner struct{}
APIObjectVersioner implements versioning and extracting database information for objects that have an embedded ObjectMeta or ListMeta field.
func (APIObjectVersioner) ObjectResourceVersion ¶
func (a APIObjectVersioner) ObjectResourceVersion(obj runtime.Object) (uint64, error)
ObjectResourceVersion implements Versioner
func (APIObjectVersioner) UpdateList ¶
func (a APIObjectVersioner) UpdateList(obj runtime.Object, resourceVersion uint64) error
UpdateList implements Versioner
func (APIObjectVersioner) UpdateObject ¶
func (a APIObjectVersioner) UpdateObject(obj runtime.Object, resourceVersion uint64) error
UpdateObject implements Versioner
func (APIObjectVersioner) UpdateTypeMeta ¶
UpdateTypeMeta implements kind and version
type AfterFindTable ¶
AfterFindTable find tableObj in object then call this function
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table extract table from object
func (*Table) BaseCondition ¶
func (t *Table) BaseCondition(dbHandle *gorm.DB, p storage.SelectionPredicate, selectionFeild []string) *gorm.DB
BaseCondition build select condition
func (*Table) ConvertFieldsValue ¶
ConvertFieldsValue convert struct value to sqlvale
func (*Table) CovertRowsToObject ¶
CovertRowsToObject update table(reflect.value) into obj(runtime.Object). and Marshal obj into row(RowResult)
func (*Table) ExtractTableObj ¶
func (t *Table) ExtractTableObj(obj runtime.Object, afterFunc AfterFindTable) error
ExtractTableObj extract table field in obj. passthrough tableObj with afterFunc
func (*Table) Fields ¶
func (t *Table) Fields(dbHandle *gorm.DB, p storage.SelectionPredicate, selectionFeild []string) *gorm.DB
Fields build gorm select condition by storage.SelectionPredicate selectionFeild contains what field will be select for query
func (*Table) GetColumnByField ¶
GetColumnByField get sql column name by struct filed name
func (*Table) ObjMapField ¶
func (t *Table) ObjMapField(obj reflect.Value, field []string, ignoreConstField bool) map[string]interface{}
ObjMapField convert obj field into map by filed,if field is nil return all field if ignoreConstField==true. will ignore filed if it has const keyword
func (*Table) ObjSelectField ¶
ObjSelectField return talbe column array
func (*Table) PageCondition ¶
func (t *Table) PageCondition(dbHandle *gorm.DB, p storage.SelectionPredicate, totalCount uint64) *gorm.DB
PageCondition build gorm selection by PageCondition