db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CookieLife = 168 * time.Hour
)
View Source
var (
	ErrNotFound = driver.ErrNoDocuments
)

Functions

This section is empty.

Types

type ErrDuplicateKey

type ErrDuplicateKey struct {
	Internal error
}

func (*ErrDuplicateKey) Error

func (e *ErrDuplicateKey) Error() string

type Game

type Game struct {
	ID primitive.ObjectID `bson:"_id,omitempty" json:"-"`

	// These could be from `levels` collection instead, but since we're using
	// hard-coded levels for this version, it's reasonable to put them here.
	Title       string   `bson:"title" json:"title,omitempty"`
	SuccessText []string `bson:"success_text" json:"success_text,omitempty"`
	FailureText []string `bson:"failure_text" json:"failure_text,omitempty"`
	Prompt      string   `bson:"prompt" json:"prompt,omitempty"`
	Width       int32    `bson:"width" json:"width,omitempty"`
	Height      int32    `bson:"height" json:"height,omitempty"`

	Map [][]MapTile `bson:"map" json:"map"`

	LevelID   string    `bson:"level" json:"-"`
	CreatedAt time.Time `bson:"created_at" json:"-"`
	UpdatedAt time.Time `bson:"updated_at" json:"-"`
	Status    string    `bson:"status" json:"status"`

	UserID string `bson:"user" json:"-"`
}

type Level

type Level struct {
	ID primitive.ObjectID `bson:"_id,omitempty" json:"-"`
}

type MapTile

type MapTile struct {
	ImageID  string `bson:"image_id" json:"image_id"`
	ImageTag string `bson:"image_tag" json:"image_tag"`
	URL      string `bson:"-" json:"url"`
}

type Photo

type Photo struct {
	ID primitive.ObjectID `bson:"_id,omitempty" json:"-"`

	Seq      int32             `bson:"seq" json:"id"`
	Key      string            `bson:"key" json:"key"`
	Desc     string            `bson:"desc" json:"desc"`
	Original string            `bson:"original" json:"original"`
	URLs     map[string]string `bson:"urls" json:"urls,omitempty"`

	// ObjectId for user-uploaded, or some predefined value for system-generated
	UserID string `bson:"user" json:"-"`
	// Has all AI variants been generated? (initial_process_complete)
	InitComplete bool   `bson:"init_complete" json:"available"`
	Progress     int32  `bson:"init_progress" json:"progress"` // 0-100 from Replicate response
	Status       string `bson:"init_status" json:"message"`    // From Replicate response, e.g. "starting"
}

type User

type User struct {
	ID primitive.ObjectID `bson:"_id,omitempty" json:"-"`

	Name   string    `bson:"name" json:"name"`
	Nick   string    `bson:"nick" json:"nickname"`
	Avatar string    `bson:"avatar" json:"avatar"`
	Stats  UserStats `bson:"stats" json:"stats"`

	NextPicSeq int32   `bson:"next_pic_seq" json:"-"`
	Album      []Photo `bson:"-" json:"album"` // Filled by querying the `photos` collection
}

type UserStats

type UserStats struct {
	GamesPlayed int32 `bson:"played" json:"games_played"`
	GamesWon    int32 `bson:"won" json:"wins"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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