37 lines
670 B
Go
37 lines
670 B
Go
package intimate
|
|
|
|
import (
|
|
"database/sql"
|
|
"reflect"
|
|
)
|
|
|
|
// Source 的结构体
|
|
type Source struct {
|
|
Uid int64 //
|
|
|
|
Url string //
|
|
|
|
StreamerId sql.NullInt64 //
|
|
|
|
Source sql.NullString //
|
|
PassGob sql.NullString //
|
|
Ext interface{} //
|
|
UpdateTime sql.NullTime //
|
|
ErrorMsg sql.NullString //
|
|
|
|
Target Target //
|
|
Operator int32 //
|
|
|
|
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))
|
|
}
|