Documentation ¶
Index ¶
- Constants
- type Collection
- func (c *Collection) Client() *MongoClient
- func (c *Collection) Database() *Database
- func (c *Collection) DeleteByID(id string) error
- func (c *Collection) Drop() error
- func (c *Collection) EnsureExistance() error
- func (c *Collection) Exists() (bool, error)
- func (c *Collection) Find(filter Document) (Documents, error)
- func (c *Collection) FindById(id string, opts *FindByIdOptions) (Document, error)
- func (c *Collection) Index(name string) *Index
- func (c *Collection) IndexFromField(field string, direction int, unique bool) *Index
- func (c *Collection) InsertOne(document Document) (string, error)
- func (c *Collection) IsEmpty() (bool, error)
- func (c *Collection) Name() string
- func (c *Collection) UpdateByID(id string, update Document) error
- func (c *Collection) WithContext(ctx context.Context) *Collection
- func (c *Collection) WithLogger(logger *zap.Logger) *Collection
- type Config
- type Database
- func (d *Database) Client() *MongoClient
- func (d *Database) Collection(name string) *Collection
- func (d *Database) Drop() error
- func (d *Database) EnsureExistance() error
- func (d *Database) Exists() (bool, error)
- func (d *Database) IsEmpty() (bool, error)
- func (d *Database) Name() string
- func (d *Database) WithContext(ctx context.Context) *Database
- func (d *Database) WithLogger(logger *zap.Logger) *Database
- type Document
- type Documents
- type FindByIdOptions
- type Index
- func (i *Index) Client() *MongoClient
- func (i *Index) Collection() *Collection
- func (i *Index) Database() *Database
- func (i *Index) Direction() int
- func (i *Index) Drop() error
- func (i *Index) EnsureExistance() error
- func (i *Index) Exists() (bool, error)
- func (i *Index) Field() string
- func (i *Index) GetSpec() (*SanitizedIndexSpec, error)
- func (i *Index) Hydrate(spec *SanitizedIndexSpec) *Index
- func (i *Index) Name() string
- func (i *Index) Unique() bool
- func (i *Index) WithContext(ctx context.Context) *Index
- type MongoClient
- func (c *MongoClient) Client() *mongo.Client
- func (c *MongoClient) Connect() error
- func (c *MongoClient) Database(name string) *Database
- func (c *MongoClient) Disconnect()
- func (c *MongoClient) IsConnected() bool
- func (c *MongoClient) Run(callback func(client *MongoClient, err error))
- func (c *MongoClient) WithContext(ctx context.Context) *MongoClient
- func (c *MongoClient) WithLogger(logger *zap.Logger) *MongoClient
- type SanitizedIndexSpec
Constants ¶
View Source
const (
// Placeholder collection name for explicit database creation.
PlaceholderCollectionName = "__terraform_provider_mongodb"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
func (*Collection) Client ¶
func (c *Collection) Client() *MongoClient
func (*Collection) Database ¶
func (c *Collection) Database() *Database
func (*Collection) DeleteByID ¶
func (c *Collection) DeleteByID(id string) error
func (*Collection) Drop ¶
func (c *Collection) Drop() error
func (*Collection) EnsureExistance ¶
func (c *Collection) EnsureExistance() error
func (*Collection) Exists ¶
func (c *Collection) Exists() (bool, error)
func (*Collection) Find ¶ added in v0.4.0
func (c *Collection) Find(filter Document) (Documents, error)
func (*Collection) FindById ¶
func (c *Collection) FindById(id string, opts *FindByIdOptions) (Document, error)
func (*Collection) Index ¶
func (c *Collection) Index(name string) *Index
func (*Collection) IndexFromField ¶
func (c *Collection) IndexFromField(field string, direction int, unique bool) *Index
func (*Collection) IsEmpty ¶
func (c *Collection) IsEmpty() (bool, error)
func (*Collection) Name ¶
func (c *Collection) Name() string
func (*Collection) UpdateByID ¶
func (c *Collection) UpdateByID(id string, update Document) error
func (*Collection) WithContext ¶
func (c *Collection) WithContext(ctx context.Context) *Collection
func (*Collection) WithLogger ¶
func (c *Collection) WithLogger(logger *zap.Logger) *Collection
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) Client ¶
func (d *Database) Client() *MongoClient
func (*Database) Collection ¶
func (d *Database) Collection(name string) *Collection
func (*Database) EnsureExistance ¶
type Document ¶
type Document map[string]interface{}
type FindByIdOptions ¶
type FindByIdOptions struct {
IncludeId bool
}
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func (*Index) Client ¶
func (i *Index) Client() *MongoClient
func (*Index) Collection ¶
func (i *Index) Collection() *Collection
func (*Index) EnsureExistance ¶
func (*Index) GetSpec ¶
func (i *Index) GetSpec() (*SanitizedIndexSpec, error)
func (*Index) Hydrate ¶
func (i *Index) Hydrate(spec *SanitizedIndexSpec) *Index
type MongoClient ¶
type MongoClient struct {
// contains filtered or unexported fields
}
func FromURI ¶
func FromURI(uri string) *MongoClient
func (*MongoClient) Client ¶
func (c *MongoClient) Client() *mongo.Client
func (*MongoClient) Connect ¶
func (c *MongoClient) Connect() error
func (*MongoClient) Database ¶
func (c *MongoClient) Database(name string) *Database
func (*MongoClient) Disconnect ¶
func (c *MongoClient) Disconnect()
func (*MongoClient) IsConnected ¶
func (c *MongoClient) IsConnected() bool
func (*MongoClient) Run ¶
func (c *MongoClient) Run(callback func(client *MongoClient, err error))
func (*MongoClient) WithContext ¶
func (c *MongoClient) WithContext(ctx context.Context) *MongoClient
func (*MongoClient) WithLogger ¶
func (c *MongoClient) WithLogger(logger *zap.Logger) *MongoClient
Click to show internal directories.
Click to hide internal directories.