51fe6f6039
TODO: 整理代码, 让入库提取数据成为 基础库.
405 lines
10 KiB
Go
405 lines
10 KiB
Go
package intimate
|
|
|
|
import (
|
|
"database/sql"
|
|
)
|
|
|
|
type ISetAnchorInfo interface {
|
|
SetUid(int64) //
|
|
SetPlatform(string) //
|
|
SetAnchorId(string) //
|
|
SetAnchorName(string) //
|
|
SetLiveUrl(sql.NullString) //
|
|
SetChannel(sql.NullString) //
|
|
SetTags(interface{}) //
|
|
SetExt(interface{}) //
|
|
SetUpdateTime(sql.NullTime) //
|
|
}
|
|
|
|
type IGetAnchorInfo interface {
|
|
GetUid() int64 //
|
|
GetPlatform() string //
|
|
GetAnchorId() string //
|
|
GetAnchorName() string //
|
|
GetLiveUrl() sql.NullString //
|
|
GetChannel() sql.NullString //
|
|
GetTags() interface{}
|
|
GetExt() interface{} //
|
|
GetUpdateTime() sql.NullTime //
|
|
}
|
|
|
|
/*
|
|
CREATE TABLE `anchor_info` (
|
|
`uid` bigint AUTO_INCREMENT,
|
|
`platform` varchar(255) NOT NULL,
|
|
`anchor_id` varchar(255) NOT NULL,
|
|
`anchor_name` varchar(255) NOT NULL,
|
|
`live_url` text,
|
|
`channel` varchar(128) DEFAULT NULL,
|
|
`show_type` varchar(255) DEFAULT NULL,
|
|
`ext` json DEFAULT NULL,
|
|
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`uid`),
|
|
UNIQUE KEY `platform_anchor_id_idx` (`platform`, `anchor_id`),
|
|
KEY `platform_idx` (`platform`),
|
|
KEY `anchor_id_idx` (`anchor_id`),
|
|
KEY `anchor_name_idx` (`anchor_name`),
|
|
KEY `channel_idx` (`channel`),
|
|
KEY `show_type_idx` (`show_type`),
|
|
KEY `update_time_idx` (`update_time`)
|
|
);
|
|
*/
|
|
|
|
type AnchorInfo struct {
|
|
Uid int64 //
|
|
Platform string //
|
|
AnchorId string //
|
|
AnchorName string //
|
|
LiveUrl sql.NullString //
|
|
Channel sql.NullString //
|
|
Tags interface{}
|
|
Ext interface{} //
|
|
UpdateTime sql.NullTime //
|
|
}
|
|
|
|
// GetTags Get return Tags interface{}
|
|
func (ai *AnchorInfo) GetTags() interface{} {
|
|
return ai.Tags
|
|
}
|
|
|
|
// SetTags Set Tags interface{}
|
|
func (ai *AnchorInfo) SetTags(Tags interface{}) {
|
|
ai.Tags = Tags
|
|
}
|
|
|
|
// GetUpdateTime Get return UpdateTime time.Time
|
|
func (ai *AnchorInfo) GetUpdateTime() sql.NullTime {
|
|
return ai.UpdateTime
|
|
}
|
|
|
|
// SetUpdateTime Set UpdateTime time.Time
|
|
func (ai *AnchorInfo) SetUpdateTime(UpdateTime sql.NullTime) {
|
|
ai.UpdateTime = UpdateTime
|
|
}
|
|
|
|
// GetExt Get return Ext interface{}
|
|
func (ai *AnchorInfo) GetExt() interface{} {
|
|
return ai.Ext
|
|
}
|
|
|
|
// SetExt Set Ext interface{}
|
|
func (ai *AnchorInfo) SetExt(Ext interface{}) {
|
|
ai.Ext = Ext
|
|
}
|
|
|
|
// GetChannel Get return Channel sql.NullString
|
|
func (ai *AnchorInfo) GetChannel() sql.NullString {
|
|
return ai.Channel
|
|
}
|
|
|
|
// SetChannel Set Channel sql.NullString
|
|
func (ai *AnchorInfo) SetChannel(Channel sql.NullString) {
|
|
ai.Channel = Channel
|
|
}
|
|
|
|
// GetLiveUrl Get return LiveUrl sql.NullString
|
|
func (ai *AnchorInfo) GetLiveUrl() sql.NullString {
|
|
return ai.LiveUrl
|
|
}
|
|
|
|
// SetLiveUrl Set LiveUrl sql.NullString
|
|
func (ai *AnchorInfo) SetLiveUrl(LiveUrl sql.NullString) {
|
|
ai.LiveUrl = LiveUrl
|
|
}
|
|
|
|
// GetAnchorName Get return AnchorName string
|
|
func (ai *AnchorInfo) GetAnchorName() string {
|
|
return ai.AnchorName
|
|
}
|
|
|
|
// SetAnchorName Set AnchorName string
|
|
func (ai *AnchorInfo) SetAnchorName(AnchorName string) {
|
|
ai.AnchorName = AnchorName
|
|
}
|
|
|
|
// GetAnchorId Get return AnchorId string
|
|
func (ai *AnchorInfo) GetAnchorId() string {
|
|
return ai.AnchorId
|
|
}
|
|
|
|
// SetAnchorId Set AnchorId string
|
|
func (ai *AnchorInfo) SetAnchorId(AnchorId string) {
|
|
ai.AnchorId = AnchorId
|
|
}
|
|
|
|
// GetPlatform Get return Platform string
|
|
func (ai *AnchorInfo) GetPlatform() string {
|
|
return ai.Platform
|
|
}
|
|
|
|
// SetPlatform Set Platform string
|
|
func (ai *AnchorInfo) SetPlatform(Platform string) {
|
|
ai.Platform = Platform
|
|
}
|
|
|
|
// GetUid Get return Uid int64
|
|
func (ai *AnchorInfo) GetUid() int64 {
|
|
return ai.Uid
|
|
}
|
|
|
|
// SetUid Set Uid int64
|
|
func (ai *AnchorInfo) SetUid(Uid int64) {
|
|
ai.Uid = Uid
|
|
}
|
|
|
|
type IGetCollectLog interface {
|
|
GetUid() int64 //
|
|
GetPlatform() string //
|
|
GetAnchorId() string //
|
|
GetIsShowing() int32 //
|
|
GetIsError() int32 //
|
|
GetFollowers() sql.NullInt64 //
|
|
GetViews() sql.NullInt64 //
|
|
GetGiver() interface{} //
|
|
GetGratuity() sql.NullInt64 //
|
|
GetShowTitle() sql.NullString //
|
|
GetShowStartTime() sql.NullTime //
|
|
GetShowEndTime() sql.NullTime //
|
|
GetUpdateTime() sql.NullTime //
|
|
GetTags() interface{} //
|
|
GetExt() interface{} //
|
|
GetErrorMsg() sql.NullString //
|
|
}
|
|
|
|
type ISetCollectLog interface {
|
|
SetUid(int64) //
|
|
SetPlatform(string) //
|
|
SetAnchorId(string) //
|
|
SetIsShowing(int32) //
|
|
SetIsError(int32) //
|
|
SetFollowers(sql.NullInt64) //
|
|
SetViews(sql.NullInt64) //
|
|
SetGiver(interface{}) //
|
|
SetGratuity(sql.NullInt64) //
|
|
SetShowTitle(sql.NullString) //
|
|
SetShowStartTime(sql.NullTime) //
|
|
SetShowEndTime(sql.NullTime) //
|
|
SetUpdateTime(sql.NullTime) //
|
|
SetTags(interface{}) //
|
|
SetExt(interface{}) //
|
|
SetErrorMsg(sql.NullString) //
|
|
}
|
|
|
|
/*
|
|
CREATE TABLE `collect_log` (
|
|
`uid` bigint,
|
|
`platform` varchar(255) NOT NULL,
|
|
`anchor_id` varchar(255) NOT NULL,
|
|
|
|
`is_showing` tinyint(1) DEFAULT NULL,
|
|
`is_error` tinyint(1) DEFAULT NULL,
|
|
|
|
`followers` int(11) DEFAULT NULL,
|
|
`views` int(11) DEFAULT NULL,
|
|
`giver` json DEFAULT NULL,
|
|
`gratuity` int(11) DEFAULT NULL,
|
|
|
|
`show_title` text DEFAULT NULL,
|
|
`show_start_time` timestamp NULL DEFAULT NULL,
|
|
`show_end_time` timestamp NULL DEFAULT NULL,
|
|
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, --时间戳从源数据里获取
|
|
`ext` json DEFAULT NULL,
|
|
|
|
`error` text DEFAULT NULL,
|
|
|
|
KEY `uid_idx` (`uid`),
|
|
KEY `platform_idx` (`platform`),
|
|
KEY `anchor_id_idx` (`anchor_id`),
|
|
KEY `is_showing_idx` (`is_showing`),
|
|
KEY `is_error_idx` (`is_error`),
|
|
KEY `followers_idx` (`followers`),
|
|
KEY `views_idx` (`views`),
|
|
KEY `gratuity_idx` (`gratuity`),
|
|
KEY `update_time_idx` (`update_time`)
|
|
)
|
|
*/
|
|
|
|
type CollectLog struct {
|
|
Uid int64 //
|
|
Platform string //
|
|
AnchorId string //
|
|
IsShowing int32 //
|
|
IsError int32 //
|
|
Followers sql.NullInt64 //
|
|
Views sql.NullInt64 //
|
|
Giver interface{} //
|
|
Gratuity sql.NullInt64 //
|
|
ShowTitle sql.NullString //
|
|
ShowStartTime sql.NullTime //
|
|
ShowEndTime sql.NullTime //
|
|
UpdateTime sql.NullTime //
|
|
Tags interface{}
|
|
Ext interface{} //
|
|
ErrorMsg sql.NullString //
|
|
}
|
|
|
|
// GetTags Get return Tags interface{}
|
|
func (cl *CollectLog) GetTags() interface{} {
|
|
return cl.Tags
|
|
}
|
|
|
|
// SetTags Set Tags interface{}
|
|
func (cl *CollectLog) SetTags(Tags interface{}) {
|
|
cl.Tags = Tags
|
|
}
|
|
|
|
// GetErrorMsg Get return Error sql.NullString
|
|
func (cl *CollectLog) GetErrorMsg() sql.NullString {
|
|
return cl.ErrorMsg
|
|
}
|
|
|
|
// SetErrorMsg Set Error sql.NullString
|
|
func (cl *CollectLog) SetErrorMsg(ErrorMsg sql.NullString) {
|
|
cl.ErrorMsg = ErrorMsg
|
|
}
|
|
|
|
// GetExt Get return Ext interface{}
|
|
func (cl *CollectLog) GetExt() interface{} {
|
|
return cl.Ext
|
|
}
|
|
|
|
// SetExt Set Ext interface{}
|
|
func (cl *CollectLog) SetExt(Ext interface{}) {
|
|
cl.Ext = Ext
|
|
}
|
|
|
|
// GetUpdateTime Get return UpdateTime time.Time
|
|
func (cl *CollectLog) GetUpdateTime() sql.NullTime {
|
|
return cl.UpdateTime
|
|
}
|
|
|
|
// SetUpdateTime Set UpdateTime time.Time
|
|
func (cl *CollectLog) SetUpdateTime(UpdateTime sql.NullTime) {
|
|
cl.UpdateTime = UpdateTime
|
|
}
|
|
|
|
// GetShowEndTime Get return ShowEndTime sql.NullTime
|
|
func (cl *CollectLog) GetShowEndTime() sql.NullTime {
|
|
return cl.ShowEndTime
|
|
}
|
|
|
|
// SetShowEndTime Set ShowEndTime sql.NullTime
|
|
func (cl *CollectLog) SetShowEndTime(ShowEndTime sql.NullTime) {
|
|
cl.ShowEndTime = ShowEndTime
|
|
}
|
|
|
|
// GetShowStartTime Get return ShowStartTime sql.NullTime
|
|
func (cl *CollectLog) GetShowStartTime() sql.NullTime {
|
|
return cl.ShowStartTime
|
|
}
|
|
|
|
// SetShowStartTime Set ShowStartTime sql.NullTime
|
|
func (cl *CollectLog) SetShowStartTime(ShowStartTime sql.NullTime) {
|
|
cl.ShowStartTime = ShowStartTime
|
|
}
|
|
|
|
// GetShowTitle Get return ShowTitle sql.NullString
|
|
func (cl *CollectLog) GetShowTitle() sql.NullString {
|
|
return cl.ShowTitle
|
|
}
|
|
|
|
// SetShowTitle Set ShowTitle sql.NullString
|
|
func (cl *CollectLog) SetShowTitle(ShowTitle sql.NullString) {
|
|
cl.ShowTitle = ShowTitle
|
|
}
|
|
|
|
// GetGratuity Get return Gratuity sql.NullInt32
|
|
func (cl *CollectLog) GetGratuity() sql.NullInt64 {
|
|
return cl.Gratuity
|
|
}
|
|
|
|
// SetGratuity Set Gratuity sql.NullInt32
|
|
func (cl *CollectLog) SetGratuity(Gratuity sql.NullInt64) {
|
|
cl.Gratuity = Gratuity
|
|
}
|
|
|
|
// GetGiver Get return Giver interface{}
|
|
func (cl *CollectLog) GetGiver() interface{} {
|
|
return cl.Giver
|
|
}
|
|
|
|
// SetGiver Set Giver interface{}
|
|
func (cl *CollectLog) SetGiver(Giver interface{}) {
|
|
cl.Giver = Giver
|
|
}
|
|
|
|
// GetViews Get return Views sql.NullInt64
|
|
func (cl *CollectLog) GetViews() sql.NullInt64 {
|
|
return cl.Views
|
|
}
|
|
|
|
// SetViews Set Views sql.NullInt64
|
|
func (cl *CollectLog) SetViews(Views sql.NullInt64) {
|
|
cl.Views = Views
|
|
}
|
|
|
|
// GetFollowers Get return Followers sql.NullInt64
|
|
func (cl *CollectLog) GetFollowers() sql.NullInt64 {
|
|
return cl.Followers
|
|
}
|
|
|
|
// SetFollowers Set Followers sql.NullInt32
|
|
func (cl *CollectLog) SetFollowers(Followers sql.NullInt64) {
|
|
cl.Followers = Followers
|
|
}
|
|
|
|
// GetIsError Get return IsError int32
|
|
func (cl *CollectLog) GetIsError() int32 {
|
|
return cl.IsError
|
|
}
|
|
|
|
// SetIsError Set IsError int32
|
|
func (cl *CollectLog) SetIsError(IsError int32) {
|
|
cl.IsError = IsError
|
|
}
|
|
|
|
// GetIsShowing Get return IsShowing int32
|
|
func (cl *CollectLog) GetIsShowing() int32 {
|
|
return cl.IsShowing
|
|
}
|
|
|
|
// SetIsShowing Set IsShowing int32
|
|
func (cl *CollectLog) SetIsShowing(IsShowing int32) {
|
|
cl.IsShowing = IsShowing
|
|
}
|
|
|
|
// GetAnchorId Get return AnchorId string
|
|
func (cl *CollectLog) GetAnchorId() string {
|
|
return cl.AnchorId
|
|
}
|
|
|
|
// SetAnchorId Set AnchorId string
|
|
func (cl *CollectLog) SetAnchorId(AnchorId string) {
|
|
cl.AnchorId = AnchorId
|
|
}
|
|
|
|
// GetPlatform Get return Platform string
|
|
func (cl *CollectLog) GetPlatform() string {
|
|
return cl.Platform
|
|
}
|
|
|
|
// SetPlatform Set Platform string
|
|
func (cl *CollectLog) SetPlatform(Platform string) {
|
|
cl.Platform = Platform
|
|
}
|
|
|
|
// GetUid Get return Uid int64
|
|
func (cl *CollectLog) GetUid() int64 {
|
|
return cl.Uid
|
|
}
|
|
|
|
// SetUid Set Uid int64
|
|
func (cl *CollectLog) SetUid(Uid int64) {
|
|
cl.Uid = Uid
|
|
}
|