Documentation
¶
Index ¶
Constants ¶
View Source
const ( COLLECTION_NAME = "dotlan_status" DATABASE_NAME = "unwindia" DEFAULT_TIMEOUT = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseClient ¶
type DatabaseClient interface { Upsert(*DotlanStatus) (*DotlanStatus, error) List(ctx context.Context, filter interface{}, c chan Result) }
DatabaseClient is the client-interface for the main mongodb database
type DatabaseClientImpl ¶
type DatabaseClientImpl struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(ctx context.Context, env *environment.Environment, workerpool *workerpool.WorkerPool) (*DatabaseClientImpl, error)
func NewClientWithDatabase ¶
func NewClientWithDatabase(db *mongo.Database, workerpool *workerpool.WorkerPool) (*DatabaseClientImpl, error)
func (*DatabaseClientImpl) List ¶
func (d *DatabaseClientImpl) List(ctx context.Context, filter interface{}, c chan Result)
func (*DatabaseClientImpl) Upsert ¶
func (d *DatabaseClientImpl) Upsert(doc *DotlanStatus) (*DotlanStatus, error)
type DotlanMatchChanges ¶
type DotlanMatchChanges struct {
DotlanStatusList
}
DotlanMatchChanges is a list of changes to a dotlan match which needs to be published to the message queue.
type DotlanStatus ¶
type DotlanStatus struct { DotlanContestID uint `bson:"_id" json:"dotlanContestId"` Events DotlanStatusEvents `bson:"events,omitempty"` MatchInfo matchservice.MatchInfo `bson:"matchInfo,omitempty"` CreatedAt time.Time `bson:"createdAt,omitempty"` UpdatedAt time.Time `bson:"updatedAt,omitempty"` }
type DotlanStatusEvent ¶
type DotlanStatusEvent string
const ( CMS_CONTEST_NEW DotlanStatusEvent = "CMS_CONTEST_NEW" CMS_CONTEST_READY_1 DotlanStatusEvent = "CMS_CONTEST_READY_1" // contest.ready_a > 0 CMS_CONTEST_READY_2 DotlanStatusEvent = "CMS_CONTEST_READY_2" // contest.ready_b > 0 CMS_CONTEST_READY_ALL DotlanStatusEvent = "CMS_CONTEST_READY_ALL" CMS_CONTEST_FINISHED DotlanStatusEvent = "CMS_CONTEST_FINISHED" // contest.won > 0 )
type DotlanStatusEvents ¶
type DotlanStatusEvents []DotlanStatusEvent
func (*DotlanStatusEvents) Contains ¶
func (d *DotlanStatusEvents) Contains(state DotlanStatusEvent) bool
type DotlanStatusList ¶
type DotlanStatusList []DotlanStatus
func (*DotlanStatusList) GetElementById ¶
func (d *DotlanStatusList) GetElementById(id uint) *DotlanStatus
GetElementById returns the element with the given id
type Result ¶
type Result struct { Result DotlanStatusList Error error }
Click to show internal directories.
Click to hide internal directories.