database

package
v1.1.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reseved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const BAN_ADD = "moderation.user.ban"
View Source
const BAN_REMOVE = "moderation.user.unban"
View Source
const MOD_ADD = "moderation.moderator.add"
View Source
const MOD_REMOVE = "moderation.moderator.remove"
View Source
const SEP_AND = "and"
View Source
const SEP_OR = "or"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationClient

type AuthenticationClient struct {
	ID          string `db:"id"`
	Secret      string `db:"secret"`
	Name        string `db:"name"`
	IsExtension bool   `db:"is_extension"`
}

type Authorization

type Authorization struct {
	ID        int    `db:"id" dbi:"false"`
	ClientID  string `db:"client_id"`
	UserID    string `db:"user_id"`
	Token     string `db:"token"`
	ExpiresAt string `db:"expires_at"`
	Scopes    string `db:"scopes"`
}

type Ban

type Ban struct {
	UserID             string  `db:"user_id" json:"user_id"`
	UserLogin          string  `db:"user_login" json:"user_login"`
	UserName           string  `db:"user_name" json:"user_name"`
	ExpiresAt          *string `db:"expires_at" json:"expires_at"`
	CreatedAt          string  `db:"created_at" json:"created_at"`
	Reason             string  `json:"reason"`
	ModeratorID        string  `json:"moderator_id"`
	ModeratorUserLogin string  `json:"moderator_login"`
	ModeratorUserName  string  `json:"moderator_name"`
}

type BanActionEvent

type BanActionEvent struct {
	BroadcasterID      string  `db:"broadcaster_id" json:"broadcaster_id"`
	BroadcasterLogin   string  `db:"broadcaster_login" json:"broadcaster_login"`
	BroadcasterName    string  `db:"broadcaster_name" json:"broadcaster_name"`
	UserID             string  `db:"user_id" json:"user_id"`
	UserLogin          string  `db:"user_login" json:"user_login"`
	UserName           string  `db:"user_name" json:"user_name"`
	ExpiresAt          *string `db:"expires_at" json:"expires_at"`
	Reason             string  `json:"reason"`
	ModeratorID        string  `json:"moderator_id"`
	ModeratorUserLogin string  `json:"moderator_login"`
	ModeratorUserName  string  `json:"moderator_name"`
}

type BanEvent

type BanEvent struct {
	ID             string `db:"id" json:"id"`
	EventType      string `db:"event_type" json:"event_type"`
	EventTimestamp string `db:"event_timestamp" json:"event_timestamp"`
	EventVersion   string `db:"event_version" json:"version"`
	BanActionEvent `json:"event_data"`
}

type Block

type Block struct {
	UserID    string `db:"user_id" json:"user_id"`
	UserLogin string `db:"user_login" json:"user_login"`
	UserName  string `db:"user_name" json:"display_name"`
}

type CLIDatabase

type CLIDatabase struct {
	DB *sqlx.DB
}

func NewConnection

func NewConnection(extendedBusyTimeout bool) (CLIDatabase, error)

func (CLIDatabase) IsFirstRun

func (c CLIDatabase) IsFirstRun() bool

func (CLIDatabase) NewQuery

func (c CLIDatabase) NewQuery(r *http.Request, max_limit int) *Query

NewQuery handles the logic for generating the pagination token to pass alongside the DB queries for easier access

func (CLIDatabase) NewQueryWithDefaultLimit added in v1.1.16

func (c CLIDatabase) NewQueryWithDefaultLimit(r *http.Request, max_limit int, default_limit int) *Query

type Category

type Category struct {
	ID          string `db:"id" json:"id"`
	Name        string `db:"category_name" json:"name"`
	BoxartURL   string `json:"box_art_url"`
	ViewerCount int    `db:"vc" json:"-"`
	IGDB        string `db:"igdb_id" json:"igdb_id"`
}

type ChannelPointsRedemption

type ChannelPointsRedemption struct {
	ID                                string         `db:"id" json:"id" dbs:"cpr.id"`
	BroadcasterID                     string         `db:"broadcaster_id" json:"broadcaster_id" dbs:"cpr.broadcaster_id"`
	BroadcasterLogin                  string         `db:"broadcaster_login" dbi:"false" json:"broadcaster_login"`
	BroadcasterName                   string         `db:"broadcaster_name" dbi:"false" json:"broadcaster_name"`
	UserID                            string         `db:"user_id" json:"user_id"`
	UserLogin                         string         `db:"user_login" dbi:"false" json:"user_login"`
	UserName                          string         `db:"user_name" dbi:"false" json:"user_name"`
	UserInput                         sql.NullString `db:"user_input" json:"-"`
	RealUserInput                     string         `json:"user_input"`
	RedemptionStatus                  string         `db:"redemption_status" json:"status"`
	RedeemedAt                        string         `db:"redeemed_at" json:"redeemed_at"`
	RewardID                          string         `db:"reward_id" json:"-"`
	ChannelPointsRedemptionRewardInfo `json:"reward"`
}

type ChannelPointsRedemptionRewardInfo

type ChannelPointsRedemptionRewardInfo struct {
	ID           string `dbi:"false" db:"red_id" json:"id" dbs:"red.id"`
	Title        string `dbi:"false" db:"title" json:"title"`
	RewardPrompt string `dbi:"false" db:"reward_prompt" json:"prompt"`
	Cost         int    `dbi:"false" db:"cost" json:"cost"`
}

type ChannelPointsReward

type ChannelPointsReward struct {
	ID                               string         `db:"id" json:"id" dbs:"cpr.id"`
	BroadcasterID                    string         `db:"broadcaster_id" json:"broadcaster_id"`
	BroadcasterLogin                 string         `db:"broadcaster_login" dbi:"false" json:"broadcaster_login"`
	BroadcasterName                  string         `db:"broadcaster_name" dbi:"false" json:"broadcaster_name"`
	RewardImage                      sql.NullString `db:"reward_image" json:"-"`
	RealRewardImage                  *string        `json:"image"`
	BackgroundColor                  string         `db:"background_color" json:"background_color"`
	IsEnabled                        *bool          `db:"is_enabled" json:"is_enabled"`
	Cost                             *int           `db:"cost" json:"cost"`
	Title                            string         `db:"title" dbs:"cpr.title" json:"title"`
	RewardPrompt                     string         `db:"reward_prompt" json:"prompt"`
	IsUserInputRequired              bool           `db:"is_user_input_required" json:"is_user_input_required"`
	MaxPerStream                     `json:"max_per_stream_setting"`
	MaxPerUserPerStream              `json:"max_per_user_per_stream_setting"`
	GlobalCooldown                   `json:"global_cooldown_setting"`
	IsPaused                         bool `db:"is_paused" json:"is_paused"`
	IsInStock                        bool `db:"is_in_stock" json:"is_in_stock"`
	DefaultImage                     `dbi:"false" json:"default_image"`
	ShouldRedemptionsSkipQueue       bool           `db:"should_redemptions_skip_queue" json:"should_redemptions_skip_request_queue"`
	RedemptionsRedeemedCurrentStream *int           `db:"redemptions_redeemed_current_stream" json:"redemptions_redeemed_current_stream"`
	CooldownExpiresAt                sql.NullString `db:"cooldown_expires_at" json:"-"`
	RealCooldownExpiresAt            *string        `json:"cooldown_expires_at"`
}

type ChatSettings added in v1.1.16

type ChatSettings struct {
	BroadcasterID                 string `db:"broadcaster_id" json:"broadcaster_id"`
	SlowMode                      *bool  `db:"slow_mode" json:"slow_mode"`
	SlowModeWaitTime              *int   `db:"slow_mode_wait_time" json:"slow_mode_wait_time"`
	FollowerMode                  *bool  `db:"follower_mode" json:"follower_mode"`
	FollowerModeDuration          *int   `db:"follower_mode_duration" json:"follower_mode_duration"`
	SubscriberMode                *bool  `db:"subscriber_mode" json:"subscriber_mode"`
	EmoteMode                     *bool  `db:"emote_mode" json:"emote_mode"`
	UniqueChatMode                *bool  `db:"unique_chat_mode" json:"unique_chat_mode"`
	NonModeratorChatDelay         *bool  `db:"non_moderator_chat_delay" json:"non_moderator_chat_delay"`
	NonModeratorChatDelayDuration *int   `db:"non_moderator_chat_delay_duration" json:"non_moderator_chat_delay_duration"`

	// Shield mode
	ShieldModeIsActive       bool   `db:"shieldmode_is_active" json:"-"`
	ShieldModeModeratorID    string `db:"shieldmode_moderator_id" json:"-"`
	ShieldModeModeratorLogin string `db:"shieldmode_moderator_login" json:"-"`
	ShieldModeModeratorName  string `db:"shieldmode_moderator_name" json:"-"`
	ShieldModeLastActivated  string `db:"shieldmode_last_activated" json:"-"`
}

type Clip

type Clip struct {
	ID              string  `db:"id" json:"id" dbs:"c.id"`
	BroadcasterID   string  `db:"broadcaster_id" json:"broadcaster_id"`
	BroadcasterName string  `db:"broadcaster_name" json:"broadcaster_name" dbi:"false"`
	CreatorID       string  `db:"creator_id" json:"creator_id"`
	CreatorName     string  `db:"creator_name" json:"creator_name" dbi:"false"`
	VideoID         string  `db:"video_id" json:"video_id"`
	GameID          string  `db:"game_id" json:"game_id"`
	Language        string  `db:"language" dbi:"false" json:"language"`
	Title           string  `db:"title" json:"title"`
	ViewCount       int     `db:"view_count" json:"view_count"`
	CreatedAt       string  `db:"created_at" json:"created_at"`
	Duration        float64 `db:"duration" json:"duration"`
	VodOffset       int     `db:"vod_offset" json:"vod_offset"`
	IsFeatured      bool    `json:"is_featured"`
	// calculated fields
	URL          string `json:"url"`
	ThumbnailURL string `json:"thumbnail_url"`
	EmbedURL     string `json:"embed_url"`
	StartedAt    string `db:"started_at" dbi:"false" json:"-"`
	EndedAt      string `db:"ended_at" dbi:"false" json:"-"`
}

type DBResponse

type DBResponse struct {
	Cursor string      `json:"cursor"`
	Total  int         `json:"total"`
	Limit  int         `json:"-"`
	Data   interface{} `json:"data"`
}

type DefaultImage

type DefaultImage struct {
	URL1x string `json:"url_1x"`
	URL2x string `json:"url_2x"`
	URL4x string `json:"url_4x"`
}

type DropsEntitlement

type DropsEntitlement struct {
	ID          string `db:"id" json:"id" dbs:"de.id"`
	UserID      string `db:"user_id" json:"user_id"`
	BenefitID   string `db:"benefit_id" json:"benefit_id"`
	GameID      string `db:"game_id" json:"game_id"`
	Timestamp   string `db:"timestamp" json:"timestamp"`
	Status      string `db:"status" json:"fulfillment_status"`
	LastUpdated string `db:"last_updated" json:"last_updated"`
}

type Editor

type Editor struct {
	UserID    string `db:"user_id" json:"user_id"`
	UserLogin string `db:"user_login" json:"-"`
	UserName  string `db:"user_name" json:"user_name"`
	CreatedAt string `db:"created_at" json:"created_at"`
}

type EventCacheParameters

type EventCacheParameters struct {
	ID        string `db:"id"`
	Event     string `db:"event"`
	JSON      string `db:"json"`
	FromUser  string `db:"from_user"`
	ToUser    string `db:"to_user"`
	Transport string `db:"transport"`
	Timestamp string `db:"timestamp"`
}

EventCacheParameters is used to define required parameters when writing into the database

type EventCacheResponse

type EventCacheResponse struct {
	ID        string
	Event     string
	JSON      string
	Transport string
	Timestamp string
}

EventCacheResponse is used to define the response coming from a SELECT-based function

type Follow

type Follow struct {
	BroadcasterID    string `db:"to_id"`
	BroadcasterLogin string `db:"to_login"`
	BroadcasterName  string `db:"to_name"`
	ViewerID         string `db:"from_id"`
	ViewerLogin      string `db:"from_login"`
	ViewerName       string `db:"from_name"`
	FollowedAt       string `db:"created_at"`
}

type GlobalCooldown

type GlobalCooldown struct {
	GlobalCooldownEnabled bool `db:"global_cooldown_enabled" json:"is_enabled" dbi:"force"`
	GlobalCooldownSeconds *int `db:"global_cooldown_seconds" json:"global_cooldown_seconds"`
}

type InternalCursor

type InternalCursor struct {
	Offset int `json:"o"`
	Limit  int `json:"l"`
}

type InternalPagination

type InternalPagination struct {
	SQL string
	InternalCursor
	PaginationCursor string
}

type MaxPerStream

type MaxPerStream struct {
	StreamMaxEnabled bool `db:"stream_max_enabled" json:"is_enabled" dbi:"force"`
	StreamMaxCount   *int `db:"stream_max_count" json:"max_per_stream"`
}

type MaxPerUserPerStream

type MaxPerUserPerStream struct {
	StreamUserMaxEnabled bool `db:"stream_user_max_enabled" json:"is_enabled" dbi:"force"`
	StreamMUserMaxCount  *int `db:"stream_user_max_count" json:"max_per_user_per_stream"`
}

type Moderator

type Moderator struct {
	UserID    string `db:"user_id" json:"user_id"`
	UserLogin string `db:"user_login" json:"user_login"`
	UserName  string `db:"user_name" json:"user_name"`
}

type ModeratorAction

type ModeratorAction struct {
	ID                   string `db:"id" json:"id"`
	EventType            string `db:"event_type" json:"event_type"`
	EventTimestamp       string `db:"event_timestamp" json:"event_timestamp"`
	EventVersion         string `db:"event_version" json:"version"`
	ModeratorActionEvent `json:"event_data"`
}

type ModeratorActionEvent

type ModeratorActionEvent struct {
	BroadcasterID    string `db:"broadcaster_id" json:"broadcaster_id"`
	BroadcasterLogin string `db:"broadcaster_login" json:"broadcaster_login"`
	BroadcasterName  string `db:"broadcaster_name" json:"broadcaster_name"`
	UserID           string `db:"user_id" json:"user_id"`
	UserLogin        string `db:"user_login" json:"user_login"`
	UserName         string `db:"user_name" json:"user_name"`
}

type Poll

type Poll struct {
	ID                         string        `db:"id" dbs:"p.id" json:"id"`
	BroadcasterID              string        `db:"broadcaster_id" dbs:"u1.id" json:"broadcaster_id"`
	BroadcasterLogin           string        `db:"broadcaster_login" dbi:"false" json:"broadcaster_login"`
	BroadcasterName            string        `db:"broadcaster_name" dbi:"false" json:"broadcaster_name"`
	Title                      string        `db:"title" dbs:"p.title" json:"title"`
	BitsVotingEnabled          bool          `db:"bits_voting_enabled" json:"bits_voting_enabled"`
	BitsPerVote                int           `db:"bits_per_vote" json:"bits_per_vote"`
	ChannelPointsVotingEnabled bool          `db:"channel_points_voting_enabled" json:"channel_points_voting_enabled"`
	ChannelPointsPerVote       int           `db:"channel_points_per_vote" json:"channel_points_per_vote"`
	Status                     string        `db:"status" json:"status"`
	Duration                   int           `db:"duration" json:"duration"`
	StartedAt                  string        `db:"started_at" json:"started_at"`
	EndedAt                    string        `db:"ended_at" json:"ended_at,omitempty"`
	Choices                    []PollsChoice `json:"choices"`
}

type PollsChoice

type PollsChoice struct {
	ID                 string `db:"id" json:"id"`
	Title              string `db:"title" json:"title"`
	Votes              int    `db:"votes" json:"votes"`
	ChannelPointsVotes int    `db:"channel_points_votes" json:"channel_points_votes"`
	BitsVotes          int    `db:"bits_votes" json:"bits_votes"`
	PollID             string `db:"poll_id" json:"-"`
}

type Prediction

type Prediction struct {
	ID               string              `db:"id" dbs:"p.id" json:"id"`
	BroadcasterID    string              `db:"broadcaster_id" dbs:"u1.id" json:"broadcaster_id"`
	BroadcasterLogin string              `db:"broadcaster_login" dbi:"false" json:"broadcaster_login"`
	BroadcasterName  string              `db:"broadcaster_name" dbi:"false" json:"broadcaster_name"`
	Title            string              `db:"title" json:"title"`
	WinningOutcomeID *string             `db:"winning_outcome_id" json:"winning_outcome_id"`
	PredictionWindow int                 `db:"prediction_window" json:"prediction_window"`
	Status           string              `db:"status" json:"status"`
	StartedAt        string              `db:"created_at" json:"created_at"`
	EndedAt          *string             `db:"ended_at" json:"ended_at"`
	LockedAt         *string             `db:"locked_at" json:"locked_at"`
	Outcomes         []PredictionOutcome `json:"outcomes"`
}

type PredictionOutcome

type PredictionOutcome struct {
	ID            string                  `db:"id" dbs:"po.id" json:"id"`
	Title         string                  `db:"title" json:"title"`
	Users         int                     `db:"users" json:"users"`
	ChannelPoints int                     `db:"channel_points" json:"channel_points"`
	TopPredictors []*PredictionPrediction `json:"top_predictors"`
	Color         string                  `db:"color" json:"color"`
	PredictionID  string                  `db:"prediction_id" json:"-"`
}

type PredictionPrediction

type PredictionPrediction struct {
	PredictionID string `db:"prediction_id" json:"-"`
	UserID       string `db:"user_id" json:"user_id"`
	UserLogin    string `db:"user_login" dbi:"false" json:"user_login"`
	UserName     string `db:"user_name" dbi:"false" json:"user_name"`
	Amount       int    `db:"amount" json:"channel_points_used"`
	OutcomeID    string `db:"outcome_id" json:"-"`
	// calculated fields
	AmountWon int `json:"channel_points_won"`
}

type Query

type Query struct {
	Limit  int
	Cursor string
	InternalPagination
	DB *sqlx.DB
}

func (*Query) AddBlock

func (q *Query) AddBlock(p UserRequestParams) error

func (*Query) AddEditor

func (q *Query) AddEditor(p UserRequestParams) error

func (*Query) AddFollow

func (q *Query) AddFollow(p UserRequestParams) error

func (*Query) AddModerator

func (q *Query) AddModerator(p UserRequestParams) error

func (*Query) AddVIP added in v1.1.16

func (q *Query) AddVIP(p UserRequestParams) error

func (*Query) CreateAuthorization

func (q *Query) CreateAuthorization(a Authorization) (Authorization, error)

func (*Query) DeleteBan added in v1.1.16

func (q *Query) DeleteBan(p UserRequestParams) error

func (*Query) DeleteBlock

func (q *Query) DeleteBlock(from_user string, to_user string) error

func (*Query) DeleteChannelPointsReward

func (q *Query) DeleteChannelPointsReward(id string) error

func (*Query) DeleteFollow

func (q *Query) DeleteFollow(from_user string, to_user string) error

func (*Query) DeleteSegment

func (q *Query) DeleteSegment(id string, broadcasterID string) error

func (*Query) DeleteVIP added in v1.1.16

func (q *Query) DeleteVIP(broadcaster string, user string) error

func (*Query) DeleteVideo

func (q *Query) DeleteVideo(id string) error

func (*Query) GetAuthenticationClient

func (q *Query) GetAuthenticationClient(ac AuthenticationClient) (*DBResponse, error)

func (*Query) GetAuthorizationByToken

func (q *Query) GetAuthorizationByToken(token string) (Authorization, error)

func (*Query) GetBanEvents

func (q *Query) GetBanEvents(p UserRequestParams) (*DBResponse, error)

func (*Query) GetBans

func (q *Query) GetBans(p UserRequestParams) (*DBResponse, error)

func (*Query) GetBlocks

func (q *Query) GetBlocks(p UserRequestParams) (*DBResponse, error)

func (*Query) GetCategories

func (q *Query) GetCategories(cat Category) (*DBResponse, error)

func (*Query) GetChannelPointsRedemption

func (q *Query) GetChannelPointsRedemption(cpr ChannelPointsRedemption, sort string) (*DBResponse, error)

func (*Query) GetChannelPointsReward

func (q *Query) GetChannelPointsReward(cpr ChannelPointsReward) (*DBResponse, error)

func (*Query) GetChannels

func (q *Query) GetChannels(u User) (*DBResponse, error)

func (*Query) GetChatSettingsByBroadcaster added in v1.1.16

func (q *Query) GetChatSettingsByBroadcaster(broadcaster string) (*DBResponse, error)

func (*Query) GetClips

func (q *Query) GetClips(c Clip, startDate string, endDate string) (*DBResponse, error)

func (*Query) GetDropsEntitlements

func (q *Query) GetDropsEntitlements(de DropsEntitlement) (*DBResponse, error)

func (*Query) GetEditors

func (q *Query) GetEditors(u User) (*DBResponse, error)

func (*Query) GetEventByID

func (q *Query) GetEventByID(id string) (EventCacheResponse, error)

GetEventByID returns an event based on an ID provided for replay.

func (*Query) GetFollowedStreams

func (q *Query) GetFollowedStreams(userID string) (*DBResponse, error)

func (*Query) GetFollows

func (q *Query) GetFollows(p UserRequestParams, totalsFromUser bool) (*DBResponse, error)

"Total" returned depends on totalsFromUser bool. "true" will return the number of people the user from p.UserID currently follows. "false" will return the number of people the user from p.BroadcasterID currently follows.

func (*Query) GetModerationActionsByBroadcaster

func (q *Query) GetModerationActionsByBroadcaster(broadcaster string) (*DBResponse, error)

func (*Query) GetModeratorEvents

func (q *Query) GetModeratorEvents(p UserRequestParams) (*DBResponse, error)

func (*Query) GetModerators

func (q *Query) GetModerators(p UserRequestParams) (*DBResponse, error)

func (*Query) GetModeratorsForBroadcaster

func (q *Query) GetModeratorsForBroadcaster(broadcasterID string) (*DBResponse, error)

func (*Query) GetPolls

func (q *Query) GetPolls(p Poll) (*DBResponse, error)

func (*Query) GetPredictions

func (q *Query) GetPredictions(p Prediction) (*DBResponse, error)

func (*Query) GetSchedule

func (q *Query) GetSchedule(p ScheduleSegment, startTime time.Time) (*DBResponse, error)

func (*Query) GetStream

func (q *Query) GetStream(s Stream) (*DBResponse, error)

func (*Query) GetStreamMarkers

func (q *Query) GetStreamMarkers(sm StreamMarker) (*DBResponse, error)

func (*Query) GetSubscriptions

func (q *Query) GetSubscriptions(s Subscription) (*DBResponse, error)

func (*Query) GetTags

func (q *Query) GetTags(t Tag) (*DBResponse, error)

func (*Query) GetTeam

func (q *Query) GetTeam(t Team) (*DBResponse, error)

func (*Query) GetTeamByBroadcaster

func (q *Query) GetTeamByBroadcaster(broadcasterID string) (*DBResponse, error)

func (*Query) GetTopGames

func (q *Query) GetTopGames() (*DBResponse, error)

func (*Query) GetUser

func (q *Query) GetUser(u User) (User, error)

func (*Query) GetUsers

func (q *Query) GetUsers(u User) (*DBResponse, error)

func (*Query) GetVIPsByBroadcaster added in v1.1.16

func (q *Query) GetVIPsByBroadcaster(broadcaster string) (*DBResponse, error)

func (*Query) GetVacations

func (q *Query) GetVacations(p ScheduleSegment) (ScheduleVacation, error)

func (*Query) GetVideos

func (q *Query) GetVideos(v Video, period string, sort string) (*DBResponse, error)

func (*Query) InsertBan

func (q *Query) InsertBan(p UserRequestParams) error

func (*Query) InsertCategory

func (q *Query) InsertCategory(category Category, upsert bool) error

func (*Query) InsertChannelPointsRedemption

func (q *Query) InsertChannelPointsRedemption(r ChannelPointsRedemption) error

func (*Query) InsertChannelPointsReward

func (q *Query) InsertChannelPointsReward(r ChannelPointsReward) error

func (*Query) InsertChatSettings added in v1.1.16

func (q *Query) InsertChatSettings(s ChatSettings) error

func (*Query) InsertClip

func (q *Query) InsertClip(c Clip) error

func (*Query) InsertDropsEntitlement

func (q *Query) InsertDropsEntitlement(d DropsEntitlement) error

func (*Query) InsertIntoDB

func (q *Query) InsertIntoDB(p EventCacheParameters) error

InsertIntoDB inserts an event into the database for replay functions later.

func (*Query) InsertMutedSegmentsForVideo

func (q *Query) InsertMutedSegmentsForVideo(vms VideoMutedSegment) error

func (*Query) InsertOrUpdateAuthenticationClient

func (q *Query) InsertOrUpdateAuthenticationClient(client AuthenticationClient, upsert bool) (AuthenticationClient, error)

func (*Query) InsertPoll

func (q *Query) InsertPoll(p Poll) error

func (*Query) InsertPrediction

func (q *Query) InsertPrediction(p Prediction) error

func (*Query) InsertPredictionPrediction

func (q *Query) InsertPredictionPrediction(p PredictionPrediction) error

func (*Query) InsertSchedule

func (q *Query) InsertSchedule(p ScheduleSegment) error

func (*Query) InsertStream

func (q *Query) InsertStream(p Stream, upsert bool) error

func (*Query) InsertStreamMarker

func (q *Query) InsertStreamMarker(sm StreamMarker) error

func (*Query) InsertSubscription

func (q *Query) InsertSubscription(s SubscriptionInsert) error

func (*Query) InsertTag

func (q *Query) InsertTag(t Tag) error

func (*Query) InsertTeam

func (q *Query) InsertTeam(t Team) error

func (*Query) InsertTeamMember

func (q *Query) InsertTeamMember(tm TeamMember) error

func (*Query) InsertUser

func (q *Query) InsertUser(u User, upsert bool) error

func (*Query) InsertVideo

func (q *Query) InsertVideo(v Video) error

func (*Query) RemoveModerator

func (q *Query) RemoveModerator(broadcaster string, user string) error

func (*Query) SearchCategories

func (q *Query) SearchCategories(query string) (*DBResponse, error)

func (*Query) SearchChannels

func (q *Query) SearchChannels(query string, live_only bool) (*DBResponse, error)

func (*Query) UpdateChannel

func (q *Query) UpdateChannel(id string, u User) error

func (*Query) UpdateChannelPointsRedemption

func (q *Query) UpdateChannelPointsRedemption(r ChannelPointsRedemption) error

func (*Query) UpdateChannelPointsReward

func (q *Query) UpdateChannelPointsReward(r ChannelPointsReward) error

func (*Query) UpdateChatSettings added in v1.1.16

func (q *Query) UpdateChatSettings(s ChatSettings) error

func (*Query) UpdateDropsEntitlement

func (q *Query) UpdateDropsEntitlement(d DropsEntitlement) error

func (*Query) UpdatePoll

func (q *Query) UpdatePoll(p Poll) error

func (*Query) UpdatePollChoice

func (q *Query) UpdatePollChoice(p PollsChoice) error

func (*Query) UpdatePrediction

func (q *Query) UpdatePrediction(p Prediction) error

func (*Query) UpdateSegment

func (q *Query) UpdateSegment(p ScheduleSegment) error

type Schedule

type Schedule struct {
	Segments  []ScheduleSegment `json:"segments"`
	UserID    string            `db:"broadcaster_id" json:"broadcaster_id"`
	UserLogin string            `db:"broadcaster_login" json:"broadcaster_login" dbi:"false"`
	UserName  string            `db:"broadcaster_name" json:"broadcaster_name" dbi:"false"`
	Vacation  *ScheduleVacation `json:"vacation"`
}

type ScheduleSegment

type ScheduleSegment struct {
	ID            string           `db:"id" json:"id" dbs:"s.id"`
	Title         string           `db:"title" json:"title"`
	StartTime     string           `db:"starttime" json:"start_time"`
	EndTime       string           `db:"endtime" json:"end_time"`
	IsRecurring   bool             `db:"is_recurring" json:"is_recurring"`
	IsVacation    bool             `db:"is_vacation" json:"-"`
	Category      *SegmentCategory `json:"category"`
	UserID        string           `db:"broadcaster_id" json:"-"`
	CategoryID    *string          `db:"category_id" json:"-"`
	CategoryName  *string          `db:"category_name" dbi:"false" json:"-"`
	IsCanceled    *bool            `db:"is_canceled" json:"-"`
	CanceledUntil *string          `json:"canceled_until"`
}

type ScheduleVacation

type ScheduleVacation struct {
	ID        string `db:"id" json:"-"`
	StartTime string `db:"starttime" json:"start_time"`
	EndTime   string `db:"endtime" json:"end_time"`
}

type SearchChannel

type SearchChannel struct {
	ID           string   `db:"id" json:"id" dbs:"u1.id"`
	UserLogin    string   `db:"user_login" json:"broadcaster_login"`
	DisplayName  string   `db:"display_name" json:"display_name"`
	CategoryID   *string  `db:"category_id" json:"game_id" dbi:"false"`
	CategoryName *string  `db:"category_name" json:"game_name" dbi:"false"`
	Title        string   `db:"title" json:"title"`
	Language     string   `db:"stream_language" json:"broadcaster_language"`
	TagIDs       []string `json:"tag_ids" dbi:"false"`
	Tags         []string `json:"tags" dbi:"false"`
	IsLive       bool     `json:"is_live" db:"is_live"`
	StartedAt    *string  `db:"started_at" json:"started_at"`
	// calculated fields
	ThumbNailURL string `json:"thumbnail_url"`
}

type SegmentCategory

type SegmentCategory struct {
	ID           *string `db:"category_id" json:"id" dbs:"category_id"`
	CategoryName *string `db:"category_name" json:"name" dbi:"false"`
}

type Stream

type Stream struct {
	ID          string   `db:"id" json:"id" dbs:"s.id"`
	UserID      string   `db:"broadcaster_id" json:"user_id"`
	UserLogin   string   `db:"broadcaster_login" json:"user_login" dbi:"false"`
	UserName    string   `db:"broadcaster_name" json:"user_name" dbi:"false"`
	StreamType  string   `db:"stream_type" json:"type"`
	ViewerCount int      `db:"viewer_count" json:"viewer_count"`
	StartedAt   string   `db:"started_at" json:"started_at"`
	IsMature    bool     `db:"is_mature" json:"is_mature"`
	TagIDs      []string `json:"tag_ids" dbi:"false"`
	Tags        []string `json:"tags" dbi:"false"`
	// stored in users, but pulled here for json parsing
	CategoryID       sql.NullString `db:"category_id" json:"-" dbi:"false"`
	RealCategoryID   string         `json:"game_id"`
	CategoryName     sql.NullString `db:"category_name" json:"-" dbi:"false"`
	RealCategoryName string         `json:"game_name"`
	Title            string         `db:"title" json:"title" dbi:"false"`
	Language         string         `db:"stream_language" json:"language" dbi:"false"`
	// calculated fields
	ThumbnailURL string `json:"thumbnail_url"`
}

type StreamMarker

type StreamMarker struct {
	ID              string `db:"id" dbs:"sm.id" json:"id"`
	CreatedAt       string `db:"created_at" json:"created_at"`
	PositionSeconds int    `db:"position_seconds" json:"position_seconds"`
	Description     string `db:"description" json:"description"`
	BroadcasterID   string `db:"broadcaster_id" json:"-"`
	VideoID         string `db:"video_id" dbs:"v.id" json:"-"`
	URL             string `json:"URL"`
}

type StreamMarkerUser

type StreamMarkerUser struct {
	BroadcasterID    string              `db:"broadcaster_id" json:"user_id"`
	BroadcasterLogin string              `db:"broadcaster_login" json:"user_login" dbi:"false"`
	BroadcasterName  string              `db:"broadcaster_name" json:"user_name" dbi:"false"`
	Videos           []StreamMarkerVideo `json:"videos"`
}

type StreamMarkerVideo

type StreamMarkerVideo struct {
	VideoID string         `db:"video_id" dbs:"v.id" json:"video_id"`
	Markers []StreamMarker `json:"markers"`
}

type Subscription

type Subscription struct {
	BroadcasterID    string          `db:"broadcaster_id" json:"broadcaster_id"`
	BroadcasterLogin string          `db:"broadcaster_login" json:"broadcaster_login"`
	BroadcasterName  string          `db:"broadcaster_name" json:"broadcaster_name"`
	UserID           string          `db:"user_id" json:"user_id"`
	UserLogin        string          `db:"user_login" json:"user_login"`
	UserName         string          `db:"user_name" json:"user_name"`
	IsGift           bool            `db:"is_gift" json:"is_gift"`
	GifterID         *sql.NullString `db:"gifter_id" json:"gifter_id"`
	GifterName       *sql.NullString `db:"gifter_name" json:"gifter_name"`
	GifterLogin      *sql.NullString `db:"gifter_login" json:"gifter_login"`
	Tier             string          `db:"tier" json:"tier"`
	CreatedAt        string          `db:"created_at" json:"-"`
	// calculated fields
	PlanName string `json:"plan_name"`
}

type SubscriptionInsert

type SubscriptionInsert struct {
	BroadcasterID string          `db:"broadcaster_id" json:"broadcaster_id"`
	UserID        string          `db:"user_id" json:"user_id"`
	IsGift        bool            `db:"is_gift" json:"is_gift"`
	GifterID      *sql.NullString `db:"gifter_id" json:"gifter_id,omitempty"`
	Tier          string          `db:"tier" json:"tier"`
	CreatedAt     string          `db:"created_at" json:"-"`
}

type Tag

type Tag struct {
	ID     string `db:"id" json:"id"`
	IsAuto bool   `db:"is_auto" dbi:"false" json:"is_auto"`
	Name   string `db:"tag_name" json:"tag_name"`
}

type Team

type Team struct {
	ID                 string       `db:"id" json:"id"`
	BackgroundImageUrl *string      `db:"background_image_url" json:"background_image_url"`
	Banner             *string      `db:"banner" json:"banner"`
	CreatedAt          string       `db:"created_at" json:"created_at"`
	UpdatedAt          string       `db:"updated_at" json:"updated_at"`
	Info               string       `db:"info" json:"info"`
	ThumbnailURL       string       `db:"thumbnail_url" json:"thumbnail_url"`
	TeamName           string       `db:"team_name" json:"team_name"`
	TeamDisplayName    string       `db:"team_display_name" json:"team_display_name"`
	Users              []TeamMember `json:"users"`
}

type TeamMember

type TeamMember struct {
	TeamID    string `db:"team_id" json:"-"`
	UserID    string `db:"user_id" json:"user_id"`
	UserName  string `db:"user_name" json:"user_name" dbi:"false"`
	UserLogin string `db:"user_login" json:"user_login" dbi:"false"`
}

type User

type User struct {
	ID               string         `db:"id" json:"id" dbs:"u1.id"`
	UserLogin        string         `db:"user_login" json:"login"`
	DisplayName      string         `db:"display_name" json:"display_name"`
	Email            string         `db:"email" json:"email,omitempty"`
	UserType         string         `db:"user_type" json:"type"`
	BroadcasterType  string         `db:"broadcaster_type" json:"broadcaster_type"`
	UserDescription  string         `db:"user_description" json:"description"`
	CreatedAt        string         `db:"created_at" json:"created_at"`
	ModifiedAt       string         `db:"modified_at" json:"-"`
	ProfileImageURL  string         `dbi:"false" json:"profile_image_url" `
	OfflineImageURL  string         `dbi:"false" json:"offline_image_url" `
	ViewCount        int            `dbi:"false" json:"view_count"`
	CategoryID       sql.NullString `db:"category_id" json:"game_id" dbi:"force"`
	CategoryName     sql.NullString `db:"category_name" json:"game_name" dbi:"false"`
	Title            string         `db:"title" json:"title"`
	Language         string         `db:"stream_language" json:"stream_language"`
	Delay            int            `db:"delay" json:"delay" dbi:"force"`
	ChatColor        string         `db:"chat_color" json:"-"`
	IsBrandedContent bool           `db:"branded_content" json:"is_branded_content"`

	// UnparsedCCLs is a comma seperated array (e.g. "Gambling,ViolentGraphic,ProfanityVulgarity")
	UnparsedCCLs string `db:"content_labels" json:"-"`
}

type UserRequestParams

type UserRequestParams struct {
	BroadcasterID string `db:"broadcaster_id"`
	UserID        string `db:"user_id"`
	CreatedAt     string `db:"created_at"`
}

type VIP added in v1.1.16

type VIP struct {
	BroadcasterID string `db:"broadcaster_id"`
	UserID        string `db:"user_id"`
	CreatedAt     string `db:"created_at"`
}

type Video

type Video struct {
	ID               string              `db:"id" json:"id" dbs:"v.id"`
	StreamID         *string             `db:"stream_id" json:"stream_id"`
	BroadcasterID    string              `db:"broadcaster_id" json:"user_id"`
	BroadcasterLogin string              `db:"broadcaster_login" json:"user_login" dbi:"false"`
	BroadcasterName  string              `db:"broadcaster_name" json:"user_name" dbi:"false"`
	Title            string              `db:"title" json:"title"`
	VideoDescription string              `db:"video_description" json:"description"`
	CreatedAt        string              `db:"created_at" json:"created_at"`
	PublishedAt      string              `db:"published_at" json:"published_at"`
	Viewable         string              `db:"viewable" json:"viewable"`
	ViewCount        int                 `db:"view_count" json:"view_count"`
	Duration         string              `db:"duration" json:"duration"`
	VideoLanguage    string              `db:"video_language" json:"language"`
	MutedSegments    []VideoMutedSegment `json:"muted_segments"`
	CategoryID       *string             `db:"category_id" dbs:"v.category_id" json:"-"`
	Type             string              `db:"type" json:"type"`
	// calculated fields
	URL          string `json:"url"`
	ThumbnailURL string `json:"thumbnail_url"`
	PeriodDate   string `db:"period_date" dbi:"false" json:"-"`
}

type VideoMutedSegment

type VideoMutedSegment struct {
	VideoID     string `db:"video_id" json:"-"`
	VideoOffset int    `db:"video_offset" json:"offset"`
	Duration    int    `db:"duration" json:"duration"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL