gitee.com/zhongguo168a/gocodes@v0.0.0-20230609140523-e1828349603f/datax/versionx/iface.go (about)

     1  package versionx
     2  
     3  import "gitee.com/zhongguo168a/gocodes/datax"
     4  
     5  type IObject interface {
     6  	RefGet(field string) (val interface{})
     7  	RefSet(field string, val interface{})
     8  
     9  	// 字段的路径
    10  	RefFieldPath() string
    11  	//
    12  	RefFieldChanged() bool
    13  
    14  	RefHas(field string) (val bool)
    15  	// basic
    16  	RefInt(field string) (val int)
    17  	RefFloat64(field string) (val float64)
    18  	RefString(field string) (val string)
    19  	RefBool(field string) (val bool)
    20  	RefArray(field string) datax.A
    21  	RefMap(field string) IObject
    22  	// object
    23  	RefClass(field string) IObject
    24  	RefClassCreator(field string, creator func(object IObject) IObject)
    25  
    26  	RefLastVersion() int
    27  	RefVersions() map[string]int
    28  	RefVersionComplete()
    29  	KeyVersionReset()
    30  
    31  	// 设置为nil
    32  	RefSetNil()
    33  	RefNew() IObject
    34  	RefNewIfNil() IObject
    35  	RefIsNil() bool
    36  	RefKeys() []string
    37  	RefData() datax.M
    38  	RefLength() int
    39  	RefReset(val map[string]interface{})
    40  	RefUpdate(data map[string]interface{})
    41  
    42  	//FromMap(m datax.M)
    43  	//fromMap(m datax.M)
    44  	ToMapVersion() (r datax.M)
    45  	toMapVersion(target datax.M)
    46  	ToMap() (r datax.M)
    47  	toMap(target datax.M)
    48  	ToMapByField(fieldMap datax.M) (r datax.M)
    49  }
    50  
    51  // 根
    52  type IRoot interface {
    53  	IObject
    54  	// 获取编号
    55  	// field="_id"
    56  	RefId() string
    57  	RefIdSet(val string)
    58  	RefClone() (r *Root)
    59  	RefIsRemove() bool
    60  	RefRemove()
    61  	RefDispose()
    62  	RefOnChange(func(path, field string, val interface{}))
    63  	RefReset(val map[string]interface{})
    64  }