intimate/extractor_field.go
2020-09-07 18:52:59 +08:00

104 lines
2.6 KiB
Go

package intimate
import (
"database/sql"
"reflect"
"time"
)
type GetSet struct {
}
type StreamerList struct {
UrlHash []byte //
Platform Platform //
Url string //
Label sql.NullString //
Serialize interface{}
UpdateInterval int32
UpdateTime time.Time //
ErrorMsg sql.NullString
Operator int32
LastOperator int32
}
// Get Simple Value
func (sl *StreamerList) Get(field string) interface{} {
return reflect.ValueOf(sl).Elem().FieldByName(field).Interface()
}
// Set Simple Value
func (sl *StreamerList) Set(field string, value interface{}) {
reflect.ValueOf(sl).Elem().FieldByName(field).Set(reflect.ValueOf(value))
}
type Streamer struct {
Uid int64 `field:"uid" uid:"auto"` //
Platform Platform `field:"platform"` //
UserId *string `field:"user_id"` //
UserName *sql.NullString `field:"user_name"` //
LiveUrl *sql.NullString `field:"live_url"` //
Channel *sql.NullString `field:"channel"` //
Tags interface{} `field:"tags"`
Ext interface{} `field:"ext"` //
IsUpdateStreamer bool // 更新上面的内容
IsUpdateUrl bool
UpdateInterval int32 `field:"update_interval"`
UpdateUrl interface{} `field:"update_url"`
LatestLogUid int64 `field:"latest_log_uid"`
UpdateTime *sql.NullTime `field:"update_time"` //
ErrorMsg *sql.NullString `field:"error_msg"`
Operator int32 `field:"operator"`
LastOperator int32
}
// Get Simple Value
func (ai *Streamer) Get(field string) interface{} {
return reflect.ValueOf(ai).Elem().FieldByName(field).Interface()
}
// Set Simple Value
func (ai *Streamer) Set(field string, value interface{}) {
reflect.ValueOf(ai).Elem().FieldByName(field).Set(reflect.ValueOf(value))
}
type CollectLog struct {
LogUid int64 // 日志id
StreamerUid int64 // StreamerId 表id与
Platform Platform //
UserId string // 平台的UserId
IsLiveStreaming bool //
IsError bool //
Followers sql.NullInt64 //
Views sql.NullInt64 //
Giver interface{} //
Gratuity sql.NullInt64 //
LiveTitle sql.NullString //
LiveStartTime sql.NullTime //
LiveEndTime sql.NullTime //
UpdateTime sql.NullTime //
Tags interface{}
Ext interface{} //
ErrorMsg sql.NullString //
}
// Get Simple Value
func (cl *CollectLog) Get(field string) interface{} {
return reflect.ValueOf(cl).Elem().FieldByName(field).Interface()
}
// Set Simple Value
func (cl *CollectLog) Set(field string, value interface{}) {
reflect.ValueOf(cl).Elem().FieldByName(field).Set(reflect.ValueOf(value))
}