intimate/source_field.go

32 lines
688 B
Go
Raw Normal View History

package intimate
import (
"database/sql"
"reflect"
)
// Source 的结构体
type Source struct {
2020-07-09 03:38:51 +00:00
Uid int64 //
Url string //
TargetType string //
Source sql.NullString //
2020-07-13 10:10:48 +00:00
PassGob sql.NullString //
Ext interface{} //
2020-07-14 11:00:34 +00:00
UpdateTime sql.NullTime //
Operator int32 //
ErrorMsg sql.NullString //
2020-07-10 04:05:33 +00:00
LastOperator int32
}
// Get Simple Value
func (so *Source) Get(field string) interface{} {
return reflect.ValueOf(so).Elem().FieldByName(field).Interface()
}
// Set Simple Value
func (so *Source) Set(field string, value interface{}) {
reflect.ValueOf(so).Elem().FieldByName(field).Set(reflect.ValueOf(value))
}