Documentation ¶
Index ¶
- Constants
- type Client
- type ClientWrapping
- type Collection
- type CollectionWrapping
- func (c *CollectionWrapping) Count(ctx context.Context, filter interface{}) (int64, error)
- func (c *CollectionWrapping) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (Cursor, error)
- func (c *CollectionWrapping) FindOne(ctx context.Context, filter interface{}) SingleResult
- func (c *CollectionWrapping) InsertOne(ctx context.Context, doc interface{}) (*mongo.InsertOneResult, error)
- type Cursor
- type CursorWrapping
- type Database
- type DatabaseWrapping
- type Planet
- type SingleResult
- type Storage
- func (s *Storage) AddPlanet(ctx context.Context, p adding.Planet) (string, error)
- func (s *Storage) Connect(ctx context.Context)
- func (s *Storage) DatabaseName() string
- func (s *Storage) Disconnect(ctx context.Context)
- func (s *Storage) GetPlanet(ctx context.Context, id string) (listing.Planet, error)
- func (s *Storage) GetPlanets(ctx context.Context, offset int64, limit int64) ([]listing.Planet, int64)
- func (s *Storage) WithTimeout(timeout time.Duration) *Storage
Constants ¶
View Source
const PlanetsCollection = "planets"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientWrapping ¶
type ClientWrapping struct {
// contains filtered or unexported fields
}
func (*ClientWrapping) Database ¶
func (c *ClientWrapping) Database(name string) Database
func (*ClientWrapping) Disconnect ¶
func (c *ClientWrapping) Disconnect(ctx context.Context) error
type Collection ¶
type CollectionWrapping ¶
type CollectionWrapping struct {
// contains filtered or unexported fields
}
func (*CollectionWrapping) Count ¶
func (c *CollectionWrapping) Count(ctx context.Context, filter interface{}) (int64, error)
func (*CollectionWrapping) Find ¶
func (c *CollectionWrapping) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (Cursor, error)
func (*CollectionWrapping) FindOne ¶
func (c *CollectionWrapping) FindOne(ctx context.Context, filter interface{}) SingleResult
func (*CollectionWrapping) InsertOne ¶
func (c *CollectionWrapping) InsertOne(ctx context.Context, doc interface{}) (*mongo.InsertOneResult, error)
type CursorWrapping ¶
type CursorWrapping struct {
// contains filtered or unexported fields
}
func (*CursorWrapping) Decode ¶
func (c *CursorWrapping) Decode(v interface{}) error
func (*CursorWrapping) Err ¶
func (c *CursorWrapping) Err() error
type Database ¶
type Database interface {
Collection(string) Collection
}
type DatabaseWrapping ¶
type DatabaseWrapping struct {
// contains filtered or unexported fields
}
func (*DatabaseWrapping) Collection ¶
func (d *DatabaseWrapping) Collection(name string) Collection
type Planet ¶
type Planet struct { ID primitive.ObjectID `json:"id" bson:"_id"` Name string `json:"name" bson:"name"` Climate string `json:"climate" bson:"climate"` Terrain string `json:"terrain" bson:"terrain"` Appearances int `json:"appearances" bson:"appearances"` CreatedAt time.Time `json:"created_at" bson:"created_at"` }
Planet defines the storage form of a planet
type SingleResult ¶
type SingleResult interface {
Decode(interface{}) error
}
type Storage ¶
Storage handles MongoDB transactions and its connections and contexts
func (*Storage) DatabaseName ¶
func (*Storage) Disconnect ¶
Click to show internal directories.
Click to hide internal directories.