database

package
v0.0.0-...-1a9a3bc Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionName = "dotlan_forum_manager"
	DatabaseName   = "unwindia"
	DefaultTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseClient

type DatabaseClient interface {
	// Upsert creates or updates an DotlanForumStatus entry
	Upsert(ctx context.Context, entry *DotlanForumStatus) error
	// Get returns an existing DotlanForumStatus by the given id. Id is the id of the match within dotlan (tcontest.tcid)
	Get(ctx context.Context, id string) (*DotlanForumStatus, error)
	// List returns all existing DotlanForumStatus entries in a Result chan
	List(ctx context.Context, filter interface{}, resultChan chan Result)
}

DatabaseClient is the client-interface for the main mongodb database

type DatabaseClientImpl

type DatabaseClientImpl struct {
	// contains filtered or unexported fields
}

func NewClientWithDatabase

func NewClientWithDatabase(ctx context.Context, db *mongo.Database) (*DatabaseClientImpl, error)

func (DatabaseClientImpl) Get

func (DatabaseClientImpl) List

func (d DatabaseClientImpl) List(ctx context.Context, filter interface{}, resultChan chan Result)

func (DatabaseClientImpl) Upsert

type DotlanForumStatus

type DotlanForumStatus struct {
	ID                  string    `bson:"_id" json:"unwindiaMatchID"`
	DotlanForumPostID   int       `bson:"dotlanForumPostID" json:"dotlanForumPostID"`
	DotlanForumThreadID int       `bson:"dotlanForumThreadID" json:"dotlanForumThreadID"`
	CreatedAt           time.Time `bson:"createdAt,omitempty"`
	UpdatedAt           time.Time `bson:"updatedAt,omitempty"`
}

type DotlanForumStatusList

type DotlanForumStatusList []DotlanForumStatus

type Result

type Result struct {
	Result DotlanForumStatusList
	Error  error
}

Jump to

Keyboard shortcuts

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