intimate/extractor_field.go

105 lines
3.4 KiB
Go
Raw Permalink Normal View History

package intimate
import (
"database/sql"
"reflect"
)
type GetSet struct {
}
2020-08-05 10:49:47 +00:00
type StreamerList struct {
2020-09-09 08:49:44 +00:00
UrlHash string `field:"urlhash" uid:"true"` //
Platform string `field:"platform" ` //
Url string `field:"url" ` //
2020-08-05 10:49:47 +00:00
2020-09-08 10:24:51 +00:00
Label *sql.NullString `field:"label" ` //
2020-08-05 10:49:47 +00:00
2020-09-08 10:24:51 +00:00
Serialize interface{} `field:"serialize" `
2020-08-05 10:49:47 +00:00
2020-09-08 10:24:51 +00:00
UpdateInterval int32 `field:"update_interval" `
UpdateTime *sql.NullTime `field:"update_time" ` //
2020-08-05 10:49:47 +00:00
2020-09-08 10:24:51 +00:00
ErrorMsg *sql.NullString `field:"error_msg" ` //
Operator int32 `field:"operator" `
2020-08-05 10:49:47 +00:00
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 {
2020-09-03 10:50:32 +00:00
Uid int64 `field:"uid" uid:"auto"` //
Platform Platform `field:"platform"` //
2020-09-07 10:52:59 +00:00
UserId *string `field:"user_id"` //
2020-09-07 10:52:59 +00:00
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"` //
2020-09-16 10:53:26 +00:00
// Comments interface{} `field:"comments"`
IsUpdateStreamer bool // 更新上面的内容
IsUpdateUrl bool
2020-09-07 10:52:59 +00:00
UpdateInterval int32 `field:"update_interval"`
2020-09-08 10:24:51 +00:00
UpdateUrl interface{} `field:"update_url"` // TODO: nil
2020-09-07 10:52:59 +00:00
LatestLogUid int64 `field:"latest_log_uid"`
UpdateTime *sql.NullTime `field:"update_time"` //
2020-09-07 10:52:59 +00:00
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()
2020-07-15 11:23:45 +00:00
}
// Set Simple Value
func (ai *Streamer) Set(field string, value interface{}) {
reflect.ValueOf(ai).Elem().FieldByName(field).Set(reflect.ValueOf(value))
}
type CollectLog struct {
2020-09-08 10:24:51 +00:00
LogUid int64 `field:"log_uid"` // 日志id
StreamerUid int64 `field:"streamer_uid"` // StreamerId 表id与
Platform Platform `field:"platform"` //
UserId string `field:"user_id"` // 平台的UserId
IsLiveStreaming bool `field:"is_live_streaming"` //
IsError bool `field:"is_error"` //
Followers *sql.NullInt64 `field:"followers"` //
Views *sql.NullInt64 `field:"views"` //
Giver interface{} `field:"giver"` //
Gratuity *sql.NullInt64 `field:"gratuity"` //
LiveTitle *sql.NullString `field:"live_title"` //
LiveStartTime *sql.NullTime `field:"live_start_time"` //
LiveEndTime *sql.NullTime `field:"live_end_time"` //
UpdateTime *sql.NullTime `field:"update_time"` //
Tags interface{} `field:"tags"`
Ext interface{} `field:"ext"` //
ErrorMsg *sql.NullString `field:"error_msg"` //
2020-09-15 09:09:22 +00:00
Comments interface{} `field:"comments"` //
}
// 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))
}