integration

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerService

type DockerService struct {
	// DockerHostname determines how to access services from code. Empty means the code runs within docker.
	// when using docker-for-mac, "localhost" would be used when running outside of docker.
	DockerHostname string
	Image          string
	Version        string
	PublishedPort  string
	ContainerPort  string
	Env            []string
	Cmd            []string
	Entrypoint     []string
	HealthCheck    func(*DockerServiceInstance) error
	Instance       *DockerServiceInstance
}

DockerService contains the various settings required to create a new docker service.

func NewMongoService

func NewMongoService(withinDocker bool) *DockerService

NewMongoService returns a mongo service.

func (*DockerService) Start

func (svc *DockerService) Start() (*DockerServiceInstance, error)

Start starts the instance of the service

func (*DockerService) Stop

func (svc *DockerService) Stop()

Stop stops the currently running instance of the service

type DockerServiceInstance

type DockerServiceInstance struct {

	// ContainerName is the name of the docker container running the service.
	ContainerName string
	// DockerHost is the (hostname + port) to use within docker to access the service.
	// it does not have a scheme
	DockerHost string
	// Host is the host (hostname + port) to use outside of docker to access the service,
	// it does not have a scheme
	Host string
	// contains filtered or unexported fields
}

DockerServiceInstance represents a running service running in docker.

type Item

type Item struct {
	ID        bson.ObjectId `bson:"_id"`
	Name      string        `bson:"name"`
	CreatedAt time.Time     `bson:"createdAt"`
}

Item is the mongo collection template representing an item.

type MongoItem added in v0.5.1

type MongoItem struct {
	ID        primitive.ObjectID `bson:"_id"`
	Name      string             `bson:"name"`
	CreatedAt time.Time          `bson:"createdAt"`
}

type MongoStore added in v0.5.1

type MongoStore interface {
	Create(context.Context, *MongoItem) (*MongoItem, error)
	RemoveAll(context.Context) error
	Find(ctx context.Context, query interface{}, next string, previous string, limit int64, sortAscending bool, paginatedField string, collation *options.Collation, hint interface{}, projection interface{}) ([]*MongoItem, mongocursorpagination.Cursor, error)
	FindBSONRaw(ctx context.Context, query interface{}, next string, previous string, limit int64, sortAscending bool, paginatedField string, collation *options.Collation, hint interface{}, projection interface{}) ([]bson.Raw, mongocursorpagination.Cursor, error)
}

func NewMongoStore

func NewMongoStore(col *mongoCollectionWrapper) MongoStore

type Store

type Store interface {
	Create(i *Item) (*Item, error)
	RemoveAll() error
	Find(query interface{}, next string, previous string, limit int, sortAscending bool, paginatedField string, collation mgo.Collation) ([]*Item, mongocursorpagination.Cursor, error)
	FindBSONRaw(query interface{}, next string, previous string, limit int, sortAscending bool, paginatedField string, collation mgo.Collation) ([]bson.Raw, mongocursorpagination.Cursor, error)
	EnsureIndices() error
}

Store allows operations on items.

func NewMgoStore added in v0.5.1

func NewMgoStore(col *mgo.Collection) Store

NewMgoStore returns a new Store that uses mgo.

Jump to

Keyboard shortcuts

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