Documentation
¶
Index ¶
- Constants
- type SeedCollectionData
- type SeedComponent
- func (m *SeedComponent) AttachEnvironment(_ context.Context, _ *envite.Environment, writer *envite.Writer) error
- func (m *SeedComponent) Cleanup(context.Context) error
- func (m *SeedComponent) Config() any
- func (m *SeedComponent) EnvVars() map[string]string
- func (m *SeedComponent) ID() string
- func (m *SeedComponent) Prepare(context.Context) error
- func (m *SeedComponent) Start(ctx context.Context) error
- func (m *SeedComponent) Status(context.Context) (envite.ComponentStatus, error)
- func (m *SeedComponent) Stop(context.Context) error
- func (m *SeedComponent) Type() string
- type SeedConfig
Constants ¶
View Source
const ComponentType = "mongo seed"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SeedCollectionData ¶
type SeedCollectionData struct {
// DB - the name of the target mongo DB
DB string `json:"db,omitempty" yaml:"db,omitempty"`
// Collection - the name of the target mongo collection
Collection string `json:"collection,omitempty" yaml:"collection,omitempty"`
// Documents - a list of documents to insert using the mongo InsertMany function:
// https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo#Collection.InsertMany
Documents []any `json:"documents,omitempty" yaml:"documents,omitempty"`
}
type SeedComponent ¶
type SeedComponent struct {
// contains filtered or unexported fields
}
func NewSeedComponent ¶
func NewSeedComponent( clientProvider func() (*mongo.Client, error), config SeedConfig, ) *SeedComponent
func (*SeedComponent) AttachEnvironment ¶
func (m *SeedComponent) AttachEnvironment(_ context.Context, _ *envite.Environment, writer *envite.Writer) error
func (*SeedComponent) Config ¶
func (m *SeedComponent) Config() any
func (*SeedComponent) EnvVars ¶
func (m *SeedComponent) EnvVars() map[string]string
func (*SeedComponent) ID ¶
func (m *SeedComponent) ID() string
func (*SeedComponent) Status ¶
func (m *SeedComponent) Status(context.Context) (envite.ComponentStatus, error)
func (*SeedComponent) Type ¶
func (m *SeedComponent) Type() string
type SeedConfig ¶
type SeedConfig struct {
// ID - a unique component name
ID string `json:"id,omitempty" yaml:"id,omitempty"`
// Data - a list of objects, each represents a single mongo collection and its data
Data []*SeedCollectionData `json:"data,omitempty" yaml:"data,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.