intimate/source_field.go

37 lines
670 B
Go
Raw Normal View History

package intimate
import (
"database/sql"
"reflect"
)
// Source 的结构体
type Source struct {
2020-07-20 10:54:34 +00:00
Uid int64 //
Url string //
StreamerId sql.NullInt64 //
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 //
ErrorMsg sql.NullString //
2020-07-10 04:05:33 +00:00
Target Target //
Operator int32 //
2020-07-20 10:54:34 +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))
}