Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( UniverseResource = dsl.Resource{ Type: dsl.SimpleResource, TableRef: dsl.TableRef{ Db: "mydb", Collection: "universe", }, SoftDelete: true, ModelType: dsl.ModelType[Universe], Projection: bson.M{"caption": 1, "motd": 1}, Methods: map[string]dsl.ResourceMethod{ "set-motd": { Type: dsl.Operation, Handler: SetMotd, }, "version": { Type: dsl.View, Handler: GetVersion, }, }, } )
Functions ¶
func GetVersion ¶
func GetVersion( context echo.Context, client *mongo.Client, resource, method string, collection *mongo.Collection, validatorMaker func() *validator.Validate, filter bson.M, ) error
GetVersion is a handler that returns the current version.
Types ¶
type SetMotdBody ¶
type SetMotdBody struct {
Motd string `validate:"required,gt=0" json:"motd"`
}
SetMotdBody stands for the body for a "set-motd" method.
type Universe ¶
type Universe struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"` Caption string `validate:"required,gt=0" bson:"caption" json:"caption"` Motd string `validate:"required,gt=0" bson:"motd" json:"motd"` Version UniverseVersion `validate:"required,dive" bson:"version" json:"version"` }
Universe is a sample singleton for the whole game layout.
type UniverseVersion ¶
type UniverseVersion struct { Major uint `bson:"major" json:"major"` Minor uint `bson:"minor" json:"minor"` Revision uint `bson:"revision" json:"revision"` }
UniverseVersion stands for the version of the game's universe / layout.
Click to show internal directories.
Click to hide internal directories.