Documentation ¶
Index ¶
- Variables
- func AddressHasPendingWithdrawal(node sqalx.Node, address string) (bool, int, int, error)
- func AdjustPointsBalanceOfAddress(node sqalx.Node, address string, amount int) error
- func ClearApplicationValuesForApplication(node sqalx.Node, applicationID string) error
- func CountApplicationValuesForApplication(node sqalx.Node, applicationID string) (int, error)
- func CountMediaRaffleEntriesBetween(node sqalx.Node, onOrAfter time.Time, before time.Time) (int, error)
- func CountMediaRaffleEntriesRequestedByBetween(node sqalx.Node, onOrAfter time.Time, before time.Time, user string) (int, error)
- func Delete[T any](node sqalx.Node, t ...T) error
- func DeleteCustom[T any](node sqalx.Node, dbuilder sq.DeleteBuilder) error
- func GetASNumberReputationsWithNumbers(node sqalx.Node, numbers int) (map[int]*ASNumberReputation, error)
- func GetApplicationFilesForApplication[T ApplicationFileLike](node sqalx.Node, applicationID, filter string, pagParams *PaginationParams) ([]T, uint64, error)
- func GetApplicationFilesForApplicationAtVersion[T ApplicationFileLike](node sqalx.Node, applicationID string, version ApplicationVersion, ...) ([]T, uint64, error)
- func GetApplicationFilesWithNamesForApplication(node sqalx.Node, applicationID string, names []string) (map[string]*ApplicationFile, error)
- func GetApplicationFilesWithNamesForApplicationAtVersion(node sqalx.Node, applicationID string, version ApplicationVersion, ...) (map[string]*ApplicationFile, error)
- func GetApplicationWalletAddress(node sqalx.Node, id string) (string, error)
- func GetApplicationsWithIDs(node sqalx.Node, ids []string) (map[string]*Application, error)
- func GetBannedUserWithIDs(node sqalx.Node, ids []string) (map[string]*BannedUser, error)
- func GetConnectionWithIDs(node sqalx.Node, ids []string) (map[string]*Connection, error)
- func GetCountersWithNames(node sqalx.Node, names []string) (map[string]*Counter, error)
- func GetDisallowedMediaCollectionsWithIDs(node sqalx.Node, ids []string) (map[string]*DisallowedMediaCollection, error)
- func GetDisallowedMediaWithIDs(node sqalx.Node, ids []string) (map[string]*DisallowedMedia, error)
- func GetDocumentsWithIDs(node sqalx.Node, ids []string) (map[string]*Document, error)
- func GetPlayedMediaWithIDs(node sqalx.Node, ids []string) (map[string]*PlayedMedia, error)
- func GetTotalOfRewardBalances(node sqalx.Node) (decimal.Decimal, error)
- func GetVerifiedUserWithIDs(node sqalx.Node, ids []string) (map[string]*VerifiedUser, error)
- func GetWithSelect[T any](node sqalx.Node, sbuilder sq.SelectBuilder) ([]T, error)
- func GetWithSelectAndCount[T any](node sqalx.Node, sbuilder sq.SelectBuilder) ([]T, uint64, error)
- func Insert[T any](node sqalx.Node, t ...T) error
- func InsertCrowdfundedTransactions(node sqalx.Node, items []*CrowdfundedTransaction) error
- func InsertMediaQueueEvents(node sqalx.Node, items []*MediaQueueEvent) error
- func InsertPendingWithdrawals(node sqalx.Node, items []*PendingWithdrawal) error
- func InsertReceivedRewards(node sqalx.Node, items []*ReceivedReward) error
- func IsMediaAllowed(node sqalx.Node, mediaType MediaType, mediaID string) (bool, error)
- func IsMediaCollectionAllowed(node sqalx.Node, collectionType MediaCollectionType, collectionID string) (bool, error)
- func MustDelete[T any](node sqalx.Node, t ...T) error
- func SetLogger(l *log.Logger)
- func SetMediaOfCrowdfundedTransactionsWithoutMedia(node sqalx.Node, mediaID string) error
- func SumCrowdfundedTransactionsFromAddressSince(node sqalx.Node, address string, since time.Time) (decimal.Decimal, error)
- func SumRequestCostsOfAddressSince(node sqalx.Node, address string, since time.Time) (decimal.Decimal, error)
- func SumWithdrawalsToAddressSince(node sqalx.Node, address string, since time.Time) (decimal.Decimal, error)
- func Update[T any](node sqalx.Node, t ...T) error
- func ZeroRewardBalanceOfAddresses(node sqalx.Node, addresses []string) error
- type ASNumberReputation
- type Application
- type ApplicationFile
- type ApplicationFileLike
- type ApplicationFileMetadata
- type ApplicationValue
- type ApplicationVersion
- type AuthEvent
- type AuthMethod
- type AuthReason
- type BannedUser
- type BlockedUser
- type ChatEmote
- type Connection
- type ConnectionService
- type Counter
- type CrowdfundedTransaction
- type CrowdfundedTransactionType
- type DisallowedMedia
- func GetDisallowedMedia(node sqalx.Node, pagParams *PaginationParams) ([]*DisallowedMedia, uint64, error)
- func GetDisallowedMediaWithFilter(node sqalx.Node, filter string, pagParams *PaginationParams) ([]*DisallowedMedia, uint64, error)
- func GetDisallowedMediaWithType(node sqalx.Node, mediaType MediaType, pagParams *PaginationParams) ([]*DisallowedMedia, uint64, error)
- func GetDisallowedMediaWithTypeAndFilter(node sqalx.Node, mediaType MediaType, filter string, ...) ([]*DisallowedMedia, uint64, error)
- type DisallowedMediaCollection
- func GetDisallowedMediaCollectionWithType(node sqalx.Node, collectionType MediaCollectionType, ...) ([]*DisallowedMediaCollection, uint64, error)
- func GetDisallowedMediaCollections(node sqalx.Node, pagParams *PaginationParams) ([]*DisallowedMediaCollection, uint64, error)
- func GetDisallowedMediaCollectionsWithFilter(node sqalx.Node, filter string, pagParams *PaginationParams) ([]*DisallowedMediaCollection, uint64, error)
- func GetDisallowedMediaCollectionsWithTypeAndFilter(node sqalx.Node, collectionType MediaCollectionType, filter string, ...) ([]*DisallowedMediaCollection, uint64, error)
- type Document
- type Duration
- type GetPlayedMediaFilters
- type GetPlayedMediaOrderBy
- type MediaCollectionType
- type MediaQueueEvent
- type MediaQueueEventType
- type MediaType
- type PaginationParams
- type PendingWithdrawal
- type PlayedMedia
- func GetPlayedMedia(node sqalx.Node, filters GetPlayedMediaFilters, pagParams *PaginationParams) ([]*PlayedMedia, uint64, error)
- func GetPlayedMediaRequestedBySince(node sqalx.Node, requestedBy string, since time.Time) ([]*PlayedMedia, error)
- func LastPlaysOfMedia(node sqalx.Node, since time.Time, mediaType MediaType, mediaID string) ([]*PlayedMedia, error)
- func LastRequestsOfAddress(node sqalx.Node, address string, count int, excludeDisallowed bool) ([]*PlayedMedia, error)
- type PlayedMediaRaffleEntry
- type PointsBalance
- type PointsTx
- func GetLatestPointsTxForAddress(node sqalx.Node, address string) (*PointsTx, error)
- func GetLatestPointsTxOfTypeForAddress(node sqalx.Node, txType PointsTxType, address string) (*PointsTx, error)
- func GetPointsTxForAddress(node sqalx.Node, address string, pagParams *PaginationParams) ([]*PointsTx, uint64, error)
- type PointsTxType
- type RaffleDrawing
- type RaffleDrawingStatus
- type ReceivedReward
- type RewardBalance
- func AdjustRewardBalanceOfAddresses(node sqalx.Node, addresses []string, amount decimal.Decimal) ([]*RewardBalance, error)
- func GetRewardBalanceOfAddress(node sqalx.Node, address string) (*RewardBalance, error)
- func GetRewardBalancesReadyForAutoWithdrawal(node sqalx.Node, minBalance decimal.Decimal, unchangedSince time.Time) ([]*RewardBalance, error)
- type SpendingLeaderboardEntry
- func CrowdfundedTransactionLeaderboardBetween(node sqalx.Node, start, end time.Time, txType CrowdfundedTransactionType, ...) ([]SpendingLeaderboardEntry, error)
- func EnqueueLeaderboardBetween(node sqalx.Node, start, end time.Time, size int, showNeighbors int, ...) ([]SpendingLeaderboardEntry, error)
- func GlobalSpendingLeaderboardBetween(node sqalx.Node, start, end time.Time, size int, showNeighbors int, ...) ([]SpendingLeaderboardEntry, error)
- type Subscription
- type UserJWTClaimSeason
- type UserProfile
- type VerifiedUser
- type Withdrawal
- func GetWithdrawal(node sqalx.Node, txHash string) (*Withdrawal, error)
- func GetWithdrawals(node sqalx.Node, pagParams *PaginationParams) ([]*Withdrawal, uint64, error)
- func GetWithdrawalsCompletedBetween(node sqalx.Node, after, before time.Time, pagParams *PaginationParams) ([]*Withdrawal, uint64, error)
- func GetWithdrawalsForAddress(node sqalx.Node, address string, pagParams *PaginationParams) ([]*Withdrawal, uint64, error)
Constants ¶
This section is empty.
Variables ¶
var ConnectionServices = []ConnectionService{ConnectionServiceCryptomonKeys}
var ErrApplicationValueNotFound = errors.New("application value not found")
ErrApplicationValueNotFound is returned when we can not find the specified application value
var ErrBlockedUserNotFound = errors.New("blocked user not found")
ErrBlockedUserNotFound is returned when we can not find the specified blocked user
var ErrInsufficientPointsBalance = errors.New("insufficient points balance")
ErrInsufficientPointsBalance is returned when there is an insufficient points balance for the requested operation
var ErrJWTClaimSeasonNotFound = errors.New("JWT claim season not found")
ErrJWTClaimSeasonNotFound is returned when a JWT claim season for a specified user is not found
var ErrMediaQueueEventNotFound = errors.New("media queue event not found")
ErrMediaQueueEventNotFound is returned when we can not find the specified media queue event
var ErrNoSubscription = errors.New("subscription not found")
ErrNoSubscription is returned when we can not find the specified subscription
var ErrPointsTxNotFound = errors.New("points transaction not found")
ErrPointsTxNotFound is returned when we can not find the specified points transaction
var ErrWithdrawalNotFound = errors.New("withdrawal not found")
ErrWithdrawalNotFound is returned when we can not find the specified withdrawal
var MaxConnectionsPerService = map[ConnectionService]int{ ConnectionServiceCryptomonKeys: 1, }
Functions ¶
func AddressHasPendingWithdrawal ¶
AddressHasPendingWithdrawal returns whether an address has a pending withdrawal
func AdjustPointsBalanceOfAddress ¶
AdjustPointsBalanceOfAddress adjusts the points balance of the specified address by the specified amount
func ClearApplicationValuesForApplication ¶
ClearApplicationValuesForApplication clears all the values for the specified application
func CountApplicationValuesForApplication ¶
CountApplicationValuesForApplication returns the number of application values for the specified application
func CountMediaRaffleEntriesBetween ¶
func CountMediaRaffleEntriesBetween(node sqalx.Node, onOrAfter time.Time, before time.Time) (int, error)
CountMediaRaffleEntriesBetween counts the played media raffle entries in the specified time period
func CountMediaRaffleEntriesRequestedByBetween ¶
func CountMediaRaffleEntriesRequestedByBetween(node sqalx.Node, onOrAfter time.Time, before time.Time, user string) (int, error)
CountMediaRaffleEntriesRequestedByBetween counts the played media raffle entries in the specified time period that belong to the specified user
func DeleteCustom ¶
DeleteCustom deletes the values which match the conditions in dbuilder
func GetASNumberReputationsWithNumbers ¶
func GetASNumberReputationsWithNumbers(node sqalx.Node, numbers int) (map[int]*ASNumberReputation, error)
GetASNumberReputationsWithNumbers returns the reputations with the specified numbers
func GetApplicationFilesForApplication ¶
func GetApplicationFilesForApplication[T ApplicationFileLike](node sqalx.Node, applicationID, filter string, pagParams *PaginationParams) ([]T, uint64, error)
GetApplicationFilesForApplication returns the latest version of all the non-deleted files of an application
func GetApplicationFilesForApplicationAtVersion ¶
func GetApplicationFilesForApplicationAtVersion[T ApplicationFileLike](node sqalx.Node, applicationID string, version ApplicationVersion, filter string, pagParams *PaginationParams) ([]T, uint64, error)
GetApplicationFilesForApplication returns all the non-deleted files of an application, at the specified version
func GetApplicationFilesWithNamesForApplication ¶
func GetApplicationFilesWithNamesForApplication(node sqalx.Node, applicationID string, names []string) (map[string]*ApplicationFile, error)
GetApplicationFilesWithNamesForApplication returns the latest version of the files with the specified names for an application
func GetApplicationFilesWithNamesForApplicationAtVersion ¶
func GetApplicationFilesWithNamesForApplicationAtVersion(node sqalx.Node, applicationID string, version ApplicationVersion, names []string) (map[string]*ApplicationFile, error)
GetApplicationFilesWithNamesForApplicationAtVersion returns the files with the specified names for an application, at the specified version
func GetApplicationWalletAddress ¶
GetApplicationWalletAddress resolves an application's wallet address based on their ID The application must have been launched at least once before
func GetApplicationsWithIDs ¶
GetApplicationsWithIDs returns the latest version of the applications with the specified IDs
func GetBannedUserWithIDs ¶
GetBannedUserWithIDs returns the user bans with the specified IDs
func GetConnectionWithIDs ¶
GetConnectionWithIDs returns the connections with the specified IDs
func GetCountersWithNames ¶
GetCountersWithNames returns the counters with the specified names
func GetDisallowedMediaCollectionsWithIDs ¶
func GetDisallowedMediaCollectionsWithIDs(node sqalx.Node, ids []string) (map[string]*DisallowedMediaCollection, error)
GetDisallowedMediaCollectionsWithIDs returns the disallowed media cpllections with the specified IDs
func GetDisallowedMediaWithIDs ¶
GetDisallowedMediaWithIDs returns the disallowed media with the specified IDs
func GetDocumentsWithIDs ¶
GetDocumentsWithIDs returns the latest version of the documents with the specified IDs
func GetPlayedMediaWithIDs ¶
GetPlayedMediaWithIDs returns the played media with the specified IDs
func GetTotalOfRewardBalances ¶
GetTotalOfRewardBalances returns the sum of all balances
func GetVerifiedUserWithIDs ¶
GetVerifiedUserWithIDs returns the user verifications with the specified IDs
func GetWithSelect ¶
GetWithSelect returns a slice of all values for the generic type that match the conditions in sbuilder
func GetWithSelectAndCount ¶
GetWithSelect returns a slice of all values for the generic type that match the conditions in sbuilder along with a count of all values ignoring LIMIT or OFFSET clauses
func InsertCrowdfundedTransactions ¶
func InsertCrowdfundedTransactions(node sqalx.Node, items []*CrowdfundedTransaction) error
InsertCrowdfundedTransactions inserts the passed received rewards in the database
func InsertMediaQueueEvents ¶
func InsertMediaQueueEvents(node sqalx.Node, items []*MediaQueueEvent) error
InsertMediaQueueEvents inserts the passed received rewards in the database
func InsertPendingWithdrawals ¶
func InsertPendingWithdrawals(node sqalx.Node, items []*PendingWithdrawal) error
InsertPendingWithdrawals inserts the passed pending withdrawals in the database
func InsertReceivedRewards ¶
func InsertReceivedRewards(node sqalx.Node, items []*ReceivedReward) error
InsertReceivedRewards inserts the passed received rewards in the database
func IsMediaAllowed ¶
IsMediaAllowed returns whether the specified media is allowed
func IsMediaCollectionAllowed ¶
func IsMediaCollectionAllowed(node sqalx.Node, collectionType MediaCollectionType, collectionID string) (bool, error)
IsMediaCollectionAllowed returns whether the specified media is allowed
func MustDelete ¶
MustDelete deletes values t from the database. MustDelete is like Delete but returns an error when no rows were deleted even though a non-zero argument count was passed
func SetLogger ¶
SetLogger sets the logger that will be used for verbose output of the functions in this package
func SetMediaOfCrowdfundedTransactionsWithoutMedia ¶
SetMediaOfCrowdfundedTransactionsWithoutMedia sets the ForMedia field of all crowdfunded transactions without one to the specified value
func SumCrowdfundedTransactionsFromAddressSince ¶
func SumCrowdfundedTransactionsFromAddressSince(node sqalx.Node, address string, since time.Time) (decimal.Decimal, error)
SumCrowdfundedTransactionsFromAddressSince returns the sum of all crowdfunded transactions from an address since the specified time
func SumRequestCostsOfAddressSince ¶
func SumRequestCostsOfAddressSince(node sqalx.Node, address string, since time.Time) (decimal.Decimal, error)
SumRequestCostsOfAddressSince returns the sum of all request costs of an address since the specified time
func SumWithdrawalsToAddressSince ¶
func SumWithdrawalsToAddressSince(node sqalx.Node, address string, since time.Time) (decimal.Decimal, error)
SumWithdrawalsToAddressSince returns the sum of all withdrawals to an address since the specified time
Types ¶
type ASNumberReputation ¶
type ASNumberReputation struct { ASNumber int `dbKey:"true" dbColumn:"as_number"` IsProxy bool CreatedAt time.Time UpdatedAt time.Time }
ASNumberReputation registers the reputation of an Autonomous System by its number
func GetASNumberReputations ¶
func GetASNumberReputations(node sqalx.Node, pagParams *PaginationParams) ([]*ASNumberReputation, uint64, error)
GetASNumberReputations returns all registered reputations
func GetProxyASNumberReputations ¶
func GetProxyASNumberReputations(node sqalx.Node, pagParams *PaginationParams) ([]*ASNumberReputation, uint64, error)
GetProxyASNumberReputations returns all AS numbers marked as proxy
type Application ¶
type Application struct { ID string `dbKey:"true"` UpdatedAt ApplicationVersion `dbKey:"true"` UpdatedBy string EditMessage string AllowLaunching bool AllowFileEditing bool Autorun bool RuntimeVersion int }
Application represents an application
func GetApplications ¶
func GetApplications(node sqalx.Node, filter string, pagParams *PaginationParams) ([]*Application, uint64, error)
type ApplicationFile ¶
type ApplicationFile struct { ApplicationID string `dbKey:"true"` Name string `dbKey:"true"` UpdatedAt time.Time `dbKey:"true"` UpdatedBy string EditMessage string Deleted bool Public bool // whether the file should be served over http Type string Content []byte }
ApplicationFile represents one of the files used by an application
type ApplicationFileLike ¶
type ApplicationFileLike interface { *ApplicationFile | *ApplicationFileMetadata }
type ApplicationFileMetadata ¶
type ApplicationFileMetadata struct { ApplicationID string `dbKey:"true"` Name string `dbKey:"true"` UpdatedAt time.Time `dbKey:"true"` UpdatedBy string EditMessage string Deleted bool Public bool // whether the file should be served over http Type string }
ApplicationFileMetadata represents metadata about one of the files used by an application This is the same as the ApplicationFile, minus the content, so that listing files does not require bringing their contents from the database. Always use ApplicationFile when performing updates/deletes/insertions on a file
type ApplicationValue ¶
type ApplicationValue struct { ApplicationID string `dbKey:"true"` Key string `dbKey:"true"` Value string }
ApplicationValue represents one of the entries in an application's key-value store
func GetApplicationValue ¶
func GetApplicationValue(node sqalx.Node, applicationID, key string) (*ApplicationValue, error)
GetApplicationValue returns the application value for the specified application and key
func GetApplicationValueByIndex ¶
func GetApplicationValueByIndex(node sqalx.Node, applicationID string, index uint64) (*ApplicationValue, error)
GetApplicationValueByIndex returns the application value at the Nth index (zero-based)
type ApplicationVersion ¶
ApplicationVersion represents the version of an application
func GetEarliestVersionOfApplication ¶
func GetEarliestVersionOfApplication(node sqalx.Node, id string) (ApplicationVersion, error)
GetEarliestVersionOfApplication returns the earliest version of the application with the specified ID
func (ApplicationVersion) MarshalJSON ¶
func (d ApplicationVersion) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface
func (*ApplicationVersion) Scan ¶
func (d *ApplicationVersion) Scan(value interface{}) error
Scan implements the sql.Scanner interface.
func (*ApplicationVersion) UnmarshalJSON ¶
func (d *ApplicationVersion) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface
type AuthEvent ¶
type AuthEvent struct { Address string `dbKey:"true"` AuthenticatedAt time.Time `dbKey:"true"` Reason AuthReason ReasonInfo types.JSONText Method AuthMethod MethodInfo types.JSONText }
AuthEvent is an authentication or authorization event
type AuthMethod ¶
type AuthMethod string
AuthMethod represents the method used for authentication or authorization
const AuthMethodAccountSignature AuthMethod = "account_public_key_signature"
AuthMethodAccountSignature is used with events where a unique message signed by the account's address was used as the authentication method
const AuthMethodExternal AuthMethod = "external"
AuthMethodExternal is used with events where a trusted external system authenticated the user
const AuthMethodInteractiveConsent AuthMethod = "interactive_consent"
AuthMethodInteractiveConsent is used with events where a third party application is authorized after interactive user consent
const AuthMethodRepresentativeChange AuthMethod = "account_representative_change"
AuthMethodAddressRepresentativeChange is used with events where representative changes were used as the authentication method
type AuthReason ¶
type AuthReason string
AuthReason represents the type of motivation for authentication or authorization
const AuthReasonAuthorizeThirdParty AuthReason = "authorize_third_party"
AuthReasonAuthorizeThirdParty is used with events associated with authorizing a third party application
const AuthReasonSignIn AuthReason = "sign_in"
AuthReasonSignIn is used with events associated with signing in
const AuthReasonSpecialSignIn AuthReason = "special_sign_in"
AuthReasonSpecialSignIn is used with events where a non-standard sign-in method was used
type BannedUser ¶
type BannedUser struct { BanID string `dbKey:"true"` BannedAt time.Time BannedUntil sql.NullTime Address string RemoteAddress string FromChat bool FromEnqueuing bool FromRewards bool Reason string UnbanReason string ModeratorAddress string ModeratorName string }
BannedUser is a user ban
func GetBannedUsers ¶
func GetBannedUsers(node sqalx.Node, filter string, pagParams *PaginationParams) ([]*BannedUser, uint64, error)
GetBannedUsers returns all registered user bans, starting with the most recent one
func GetBannedUsersAtInstant ¶
func GetBannedUsersAtInstant(node sqalx.Node, instant time.Time, filter string, pagParams *PaginationParams) ([]*BannedUser, uint64, error)
GetBannedUsersAtInstant returns a slice with all user bans in effect at the specified instant, starting with the most recent one
type BlockedUser ¶
type BlockedUser struct { ID string `dbKey:"true"` Address string BlockedBy string CreatedAt time.Time }
BlockedUser represents a blocked user
func GetBlockedUserByAddress ¶
func GetBlockedUserByAddress(node sqalx.Node, address string, blockedBy string) (*BlockedUser, error)
GetBlockedUserByID returns the user block specified by the given ID
func GetBlockedUserByID ¶
func GetBlockedUserByID(node sqalx.Node, id string) (*BlockedUser, error)
GetBlockedUserByID returns the user block specified by the given ID
func GetUsersBlockedByAddress ¶
func GetUsersBlockedByAddress(node sqalx.Node, address string, pagParams *PaginationParams) ([]*BlockedUser, uint64, error)
GetUsersBlockedByAddress returns the users blocked by the specified address.
type ChatEmote ¶
type ChatEmote struct { ID int64 `dbKey:"true"` Shortcode string Animated bool AvailableForNewMessages bool RequiresSubscription bool }
ChatEmote represents a chat emote
func GetChatEmotes ¶
GetChatEmotes returns all chat emotes in the database
type Connection ¶
type Connection struct { ID string `dbKey:"true"` Service ConnectionService RewardsAddress string Name string CreatedAt time.Time UpdatedAt time.Time OAuthRefreshToken *string `dbColumn:"oauth_refresh_token"` }
Connection represents a connection between a user identity and an external service
func GetConnectionsForRewardsAddress ¶
func GetConnectionsForRewardsAddress(node sqalx.Node, address string) ([]*Connection, error)
GetConnectionsForRewardsAddress returns the connections of the specified rewards address
func GetConnectionsForServiceAndRewardsAddress ¶
func GetConnectionsForServiceAndRewardsAddress(node sqalx.Node, service ConnectionService, address string) ([]*Connection, error)
GetConnectionsForServiceAndRewardsAddress returns the connections to the given service of the specified rewards address
type ConnectionService ¶
type ConnectionService string
const ConnectionServiceCryptomonKeys ConnectionService = "cryptomonkeys"
type Counter ¶
Counter is a multipurpose integer counter
func GetCounters ¶
GetCounters returns all registered counters
type CrowdfundedTransaction ¶
type CrowdfundedTransaction struct { TxHash string `dbKey:"true"` FromAddress string Amount decimal.Decimal ReceivedAt time.Time TransactionType CrowdfundedTransactionType ForMedia *string }
CrowdfundedTransaction represents a Skip & Tip transaction received by the service
type CrowdfundedTransactionType ¶
type CrowdfundedTransactionType string
const CrowdfundedTransactionTypeRain CrowdfundedTransactionType = "rain"
const CrowdfundedTransactionTypeSkip CrowdfundedTransactionType = "skip"
type DisallowedMedia ¶
type DisallowedMedia struct { ID string `dbKey:"true"` DisallowedBy string DisallowedAt time.Time MediaType MediaType MediaID string `dbColumn:"media_id"` MediaTitle string }
DisallowedMedia is media that can't be played on the service
func GetDisallowedMedia ¶
func GetDisallowedMedia(node sqalx.Node, pagParams *PaginationParams) ([]*DisallowedMedia, uint64, error)
GetDisallowedMedia returns all disallowed media in the database
func GetDisallowedMediaWithFilter ¶
func GetDisallowedMediaWithFilter(node sqalx.Node, filter string, pagParams *PaginationParams) ([]*DisallowedMedia, uint64, error)
GetDisallowedMediaWithFilter returns all disallowed media that matches the specified filter
func GetDisallowedMediaWithType ¶
func GetDisallowedMediaWithType(node sqalx.Node, mediaType MediaType, pagParams *PaginationParams) ([]*DisallowedMedia, uint64, error)
GetDisallowedMediaWithType returns all disallowed media of the specified type
func GetDisallowedMediaWithTypeAndFilter ¶
func GetDisallowedMediaWithTypeAndFilter(node sqalx.Node, mediaType MediaType, filter string, pagParams *PaginationParams) ([]*DisallowedMedia, uint64, error)
GetDisallowedMediaWithTypeAndFilter returns all disallowed media of the given type that matches the specified filter
type DisallowedMediaCollection ¶
type DisallowedMediaCollection struct { ID string `dbKey:"true"` DisallowedBy string DisallowedAt time.Time CollectionType MediaCollectionType CollectionID string `dbColumn:"collection_id"` CollectionTitle string }
DisallowedMediaCollection is a set of media that can't be played on the service
func GetDisallowedMediaCollectionWithType ¶
func GetDisallowedMediaCollectionWithType(node sqalx.Node, collectionType MediaCollectionType, pagParams *PaginationParams) ([]*DisallowedMediaCollection, uint64, error)
GetDisallowedMediaCollectionWithType returns all disallowed media collections of the specified type
func GetDisallowedMediaCollections ¶
func GetDisallowedMediaCollections(node sqalx.Node, pagParams *PaginationParams) ([]*DisallowedMediaCollection, uint64, error)
GetDisallowedMediaCollections returns all disallowed media collections in the database
func GetDisallowedMediaCollectionsWithFilter ¶
func GetDisallowedMediaCollectionsWithFilter(node sqalx.Node, filter string, pagParams *PaginationParams) ([]*DisallowedMediaCollection, uint64, error)
GetDisallowedMediaCollectionsWithFilter returns all disallowed media collections that match the specified filter
func GetDisallowedMediaCollectionsWithTypeAndFilter ¶
func GetDisallowedMediaCollectionsWithTypeAndFilter(node sqalx.Node, collectionType MediaCollectionType, filter string, pagParams *PaginationParams) ([]*DisallowedMediaCollection, uint64, error)
GetDisallowedMediaCollectionsWithTypeAndFilter returns all disallowed media collections of the given type that match the specified filter
type Document ¶
type Document struct { ID string `dbKey:"true"` UpdatedAt time.Time `dbKey:"true"` UpdatedBy string Public bool Format string Content string }
Document represents a document
func GetDocuments ¶
type Duration ¶
Duration wraps a time.Duration with custom methods for serialization
func CountRequestsOfAddressSince ¶
func CountRequestsOfAddressSince(node sqalx.Node, address string, since time.Time) (int, Duration, error)
CountRequestsOfAddressSince returns the count and total play time of all the requests by an address since the specified time
type GetPlayedMediaFilters ¶
type GetPlayedMediaFilters struct { ExcludeDisallowed bool ExcludeCurrentlyPlaying bool StartedSince time.Time StartedUntil time.Time EnqueuedSince time.Time EnqueuedUntil time.Time TextFilter string OrderBy GetPlayedMediaOrderBy }
GetPlayedMediaFilters contains the filters to pass to GetPlayedMedia. Different conditions are ANDed together
type GetPlayedMediaOrderBy ¶
type GetPlayedMediaOrderBy string
GetPlayedMediaOrderBy specifies how to order the results of GetPlayedMedia
var GetPlayedMediaOrderByEnqueuedAtAsc GetPlayedMediaOrderBy = "played_media.enqueued_at ASC"
GetPlayedMediaOrderByEnqueuedAtAsc sorts the results of GetPlayedMedia by EnqueuedAt in ascending order
var GetPlayedMediaOrderByEnqueuedAtDesc GetPlayedMediaOrderBy = "played_media.enqueued_at DESC"
GetPlayedMediaOrderByEnqueuedAtDesc sorts the results of GetPlayedMedia by EnqueuedAt in descending order
var GetPlayedMediaOrderByStartedAtAsc GetPlayedMediaOrderBy = "played_media.started_at ASC"
GetPlayedMediaOrderByStartedAtAsc sorts the results of GetPlayedMedia by StartedAt in ascending order
var GetPlayedMediaOrderByStartedAtDesc GetPlayedMediaOrderBy = "played_media.started_at DESC"
GetPlayedMediaOrderByStartedAtDesc sorts the results of GetPlayedMedia by StartedAt in descending order
type MediaCollectionType ¶
type MediaCollectionType string
const MediaCollectionTypeSoundCloudUser MediaCollectionType = "sc_user"
const MediaCollectionTypeYouTubeChannel MediaCollectionType = "yt_channel"
type MediaQueueEvent ¶
type MediaQueueEvent struct { CreatedAt time.Time `dbKey:"true"` EventType MediaQueueEventType }
MediaQueueEvent represents a noteworthy media queue event
func GetMostRecentMediaQueueEventWithType ¶
func GetMostRecentMediaQueueEventWithType(node sqalx.Node, eventType ...MediaQueueEventType) (*MediaQueueEvent, error)
GetMostRecentMediaQueueEventWithType returns the most recent media queue event with the given type
type MediaQueueEventType ¶
type MediaQueueEventType string
MediaQueueEventType represents a type of media queue event
const MediaQueueEmptied MediaQueueEventType = "emptied"
MediaQueueEmptied is the media queue event type for when the queue becomes empty
const MediaQueueFilled MediaQueueEventType = "filled"
MediaQueueFilled is the media queue event type for when the queue becomes non-empty
type MediaType ¶
type MediaType string
const MediaTypeApplicationPage MediaType = "app_page"
const MediaTypeDocument MediaType = "document"
const MediaTypeSoundCloudTrack MediaType = "sc_track"
const MediaTypeYouTubeVideo MediaType = "yt_video"
type PaginationParams ¶
PaginationParams contains parameters needed for pagination
type PendingWithdrawal ¶
type PendingWithdrawal struct { RewardsAddress string `dbKey:"true"` Amount decimal.Decimal StartedAt time.Time }
PendingWithdrawal represents a withdrawal that has been initiated but is not yet completed
func GetPendingWithdrawals ¶
func GetPendingWithdrawals(node sqalx.Node) ([]*PendingWithdrawal, error)
GetPendingWithdrawals returns all pending withdrawals
type PlayedMedia ¶
type PlayedMedia struct { ID string `dbKey:"true"` EnqueuedAt time.Time StartedAt time.Time EndedAt sql.NullTime MediaLength Duration MediaOffset Duration RequestedBy string RequestCost decimal.Decimal Unskippable bool MediaType MediaType MediaID string `dbColumn:"media_id"` MediaInfo types.JSONText }
PlayedMedia is media that has played on the service
func GetPlayedMedia ¶
func GetPlayedMedia(node sqalx.Node, filters GetPlayedMediaFilters, pagParams *PaginationParams) ([]*PlayedMedia, uint64, error)
GetPlayedMedia returns all played media in the database according to the given filters
func GetPlayedMediaRequestedBySince ¶
func GetPlayedMediaRequestedBySince(node sqalx.Node, requestedBy string, since time.Time) ([]*PlayedMedia, error)
GetPlayedMediaRequestedBySince returns the played media that had been requested by the given address and which is playing or has finished playing since the specified moment
func LastPlaysOfMedia ¶
func LastPlaysOfMedia(node sqalx.Node, since time.Time, mediaType MediaType, mediaID string) ([]*PlayedMedia, error)
LastPlaysOfMedia returns the times the specified media was played since the specified time
func LastRequestsOfAddress ¶
func LastRequestsOfAddress(node sqalx.Node, address string, count int, excludeDisallowed bool) ([]*PlayedMedia, error)
LastRequestsOfAddress returns the most recent played medias requested by the specified address
type PlayedMediaRaffleEntry ¶
type PlayedMediaRaffleEntry struct { TicketNumber int `dbColumnRaw:"ROW_NUMBER() OVER (ORDER BY played_media.started_at) AS ticket_number"` RequestedBy string MediaID string `dbColumn:"media_id"` }
PlayedMediaRaffleEntry is the raffle entry representation of a played media entry It corresponds to the same DB entry as PlayedMedia, it's just a different "view" over it
func GetPlayedMediaRaffleEntriesBetween ¶
func GetPlayedMediaRaffleEntriesBetween(node sqalx.Node, onOrAfter time.Time, before time.Time) ([]*PlayedMediaRaffleEntry, error)
GetPlayedMediaRaffleEntriesBetween returns the played media raffle entries in the specified time period
type PointsBalance ¶
PointsBalance is the points balance of an address
func GetPointsBalanceForAddress ¶
func GetPointsBalanceForAddress(node sqalx.Node, address string) (*PointsBalance, error)
GetPointsBalanceForAddress returns the points balance of the given address
type PointsTx ¶
type PointsTx struct { ID int64 `dbKey:"true"` RewardsAddress string CreatedAt time.Time UpdatedAt time.Time Value int Type PointsTxType Extra types.JSONText }
PointsTx is a points transaction
func GetLatestPointsTxForAddress ¶
GetLatestPointsTxForAddress returns the most recent points transaction for the given address
func GetLatestPointsTxOfTypeForAddress ¶
func GetLatestPointsTxOfTypeForAddress(node sqalx.Node, txType PointsTxType, address string) (*PointsTx, error)
GetLatestPointsTxForAddress returns the most recent points transaction of the given type for the given address
func GetPointsTxForAddress ¶
func GetPointsTxForAddress(node sqalx.Node, address string, pagParams *PaginationParams) ([]*PointsTx, uint64, error)
GetPointsTxForAddress returns all the points transactions for the given address
func (*PointsTx) AdjustValue ¶
AdjustValue adjusts the value of the PointsTx by the specified amount.
type PointsTxType ¶
type PointsTxType int
const ( PointsTxTypeActivityChallengeReward PointsTxType = 1 PointsTxTypeChatActivityReward PointsTxType = 2 PointsTxTypeMediaEnqueuedReward PointsTxType = 3 PointsTxTypeChatGifAttachment PointsTxType = 4 PointsTxTypeManualAdjustment PointsTxType = 5 PointsTxTypeMediaEnqueuedRewardReversal PointsTxType = 6 PointsTxTypeConversionFromBanano PointsTxType = 7 PointsTxTypeQueueEntryReordering PointsTxType = 8 PointsTxTypeMonthlySubscription PointsTxType = 9 PointsTxTypeSkipThresholdReduction PointsTxType = 10 PointsTxTypeSkipThresholdIncrease PointsTxType = 11 PointsTxTypeConcealedEntryEnqueuing PointsTxType = 12 PointsTxTypeApplicationDefined PointsTxType = 13 )
type RaffleDrawing ¶
type RaffleDrawing struct { RaffleID string `dbKey:"true"` DrawingNumber int `dbKey:"true"` PeriodStart time.Time PeriodEnd time.Time Status RaffleDrawingStatus Reason string Plaintext *string VRFHash *string `db:"vrf_hash"` VRFProof *string `db:"vrf_proof"` WinningTicketNumber *int WinningRewardsAddress *string PrizeTxHash *string }
RaffleDrawing is one of the drawings of a raffle
func GetRaffleDrawings ¶
func GetRaffleDrawings(node sqalx.Node, pagParams *PaginationParams) ([]*RaffleDrawing, uint64, error)
GetRaffleDrawings returns all the raffle drawings
func GetRaffleDrawingsOfRaffle ¶
func GetRaffleDrawingsOfRaffle(node sqalx.Node, raffleID string) ([]*RaffleDrawing, error)
GetRaffleDrawingsOfRaffle returns all the drawings for a raffle
type RaffleDrawingStatus ¶
type RaffleDrawingStatus string
const RaffleDrawingStatusComplete RaffleDrawingStatus = "complete"
const RaffleDrawingStatusConfirmed RaffleDrawingStatus = "confirmed"
const RaffleDrawingStatusOngoing RaffleDrawingStatus = "ongoing"
const RaffleDrawingStatusPending RaffleDrawingStatus = "pending"
const RaffleDrawingStatusVoided RaffleDrawingStatus = "voided"
type ReceivedReward ¶
type ReceivedReward struct { ID string `dbKey:"true"` RewardsAddress string ReceivedAt time.Time Amount decimal.Decimal Media string }
ReceivedReward represents a reward received by a user for consuming media
func GetReceivedRewardsForAddress ¶
func GetReceivedRewardsForAddress(node sqalx.Node, address string, pagParams *PaginationParams) ([]*ReceivedReward, uint64, error)
GetReceivedRewardsForAddress returns received rewards for the specified address, starting with the latest
type RewardBalance ¶
type RewardBalance struct { RewardsAddress string `db:"rewards_address" dbKey:"true"` Balance decimal.Decimal `db:"balance"` UpdatedAt time.Time `db:"updated_at"` }
RewardBalance represents the balance of not-yet-withdrawn rewards for a user
func AdjustRewardBalanceOfAddresses ¶
func AdjustRewardBalanceOfAddresses(node sqalx.Node, addresses []string, amount decimal.Decimal) ([]*RewardBalance, error)
AdjustRewardBalanceOfAddresses adjusts the balance of the specified addresses by the specified amount
func GetRewardBalanceOfAddress ¶
func GetRewardBalanceOfAddress(node sqalx.Node, address string) (*RewardBalance, error)
GetRewardBalanceOfAddress returns the reward balance for the specified address, if one exists
func GetRewardBalancesReadyForAutoWithdrawal ¶
func GetRewardBalancesReadyForAutoWithdrawal(node sqalx.Node, minBalance decimal.Decimal, unchangedSince time.Time) ([]*RewardBalance, error)
GetRewardBalancesReadyForAutoWithdrawal returns rewards balances that are ready for automated withdrawal according to the passed parameters
type SpendingLeaderboardEntry ¶
type SpendingLeaderboardEntry struct { RowNum int Position int Address string Nickname string ApplicationID string TotalSpent decimal.Decimal }
SpendingLeaderboardEntry represents a enqueue leaderboard entry
func CrowdfundedTransactionLeaderboardBetween ¶
func CrowdfundedTransactionLeaderboardBetween(node sqalx.Node, start, end time.Time, txType CrowdfundedTransactionType, size int, showNeighbors int, mustIncludes ...string) ([]SpendingLeaderboardEntry, error)
CrowdfundedTransactionLeaderboardBetween returns the community skip or the community tipping leaderboard for the specified period
func EnqueueLeaderboardBetween ¶
func EnqueueLeaderboardBetween(node sqalx.Node, start, end time.Time, size int, showNeighbors int, mustIncludes ...string) ([]SpendingLeaderboardEntry, error)
EnqueueLeaderboardBetween returns the enqueue leaderboard for the specified period
func GlobalSpendingLeaderboardBetween ¶
func GlobalSpendingLeaderboardBetween(node sqalx.Node, start, end time.Time, size int, showNeighbors int, mustIncludes ...string) ([]SpendingLeaderboardEntry, error)
GlobalSpendingLeaderboardBetween returns the leaderboard for all forms of spending for the specified period
type Subscription ¶
type Subscription struct { RewardsAddress string `dbKey:"true"` StartsAt time.Time `dbKey:"true"` EndsAt time.Time PaymentTxs pq.Int64Array }
Subscription represents a user subscription
func GetCurrentSubscriptionAtTime ¶
func GetCurrentSubscriptionAtTime(node sqalx.Node, address string, at time.Time) (*Subscription, error)
GetCurrentSubscription returns the current subscription for the given address at the given time, or ErrNoCurrentSubscription if the address is/was not subscribed at the given time
func GetSubscriptions ¶
func GetSubscriptions(node sqalx.Node, pagParams *PaginationParams) ([]*Subscription, uint64, error)
GetSubscriptions returns all subscriptions in the database
type UserJWTClaimSeason ¶
UserJWTClaimSeason is the JWT claims season of a user
func GetUserJWTClaimSeason ¶
func GetUserJWTClaimSeason(node sqalx.Node, address string) (*UserJWTClaimSeason, error)
GetUserJWTClaimSeason returns the UserJWTClaimSeason for the specified user address
type UserProfile ¶
UserProfile represents a user profile
func GetUserProfileForAddress ¶
func GetUserProfileForAddress(node sqalx.Node, address string) (*UserProfile, error)
GetUserProfileForAddress returns the user profile for the specified address. If a profile does not exist, an empty one is returned
type VerifiedUser ¶
type VerifiedUser struct { ID string `dbKey:"true"` Address string CreatedAt time.Time SkipClientIntegrityChecks bool SkipIPAddressReputationChecks bool `dbColumn:"skip_ip_address_reputation_checks"` ReduceHardChallengeFrequency bool Reason string ModeratorAddress string ModeratorName string }
VerifiedUser represents a blocked user
func GetVerifiedUsers ¶
func GetVerifiedUsers(node sqalx.Node, filter string, pagParams *PaginationParams) ([]*VerifiedUser, uint64, error)
GetVerifiedUsers returns all registered user verifications, starting with the most recent one
type Withdrawal ¶
type Withdrawal struct { TxHash string `dbKey:"true"` RewardsAddress string Amount decimal.Decimal StartedAt time.Time CompletedAt time.Time }
Withdrawal represents a completed withdrawal
func GetWithdrawal ¶
func GetWithdrawal(node sqalx.Node, txHash string) (*Withdrawal, error)
GetWithdrawal returns the completed withdrawal with the given hash
func GetWithdrawals ¶
func GetWithdrawals(node sqalx.Node, pagParams *PaginationParams) ([]*Withdrawal, uint64, error)
GetWithdrawals returns all completed withdrawals in the database
func GetWithdrawalsCompletedBetween ¶
func GetWithdrawalsCompletedBetween(node sqalx.Node, after, before time.Time, pagParams *PaginationParams) ([]*Withdrawal, uint64, error)
GetWithdrawalsCompletedBefore returns the withdrawals completed in the specified interval
func GetWithdrawalsForAddress ¶
func GetWithdrawalsForAddress(node sqalx.Node, address string, pagParams *PaginationParams) ([]*Withdrawal, uint64, error)
GetWithdrawalsForAddress returns completed withdrawals to the specified address, starting with the latest
Source Files ¶
- application.go
- application_file.go
- application_value.go
- as_number_reputation.go
- auth_event.go
- banned_user.go
- blocked_user.go
- chat_emote.go
- connection.go
- connection_service.go
- counter.go
- crowdfunded_transaction.go
- disallowed_media.go
- disallowed_media_collection.go
- document.go
- duration.go
- leaderboard.go
- media_queue_event.go
- media_type.go
- pagination.go
- pending_withdrawal.go
- played_media.go
- points_balance.go
- points_tx.go
- raffle_drawing.go
- received_reward.go
- reward_balance.go
- subscription.go
- types.go
- user_jwt_claim_season.go
- user_profile.go
- verified_user.go
- withdrawal.go