mongodb

package
v0.0.0-...-280633d Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client that connects to Mongo DB and reads or saves Metis data.

func NewClient

func NewClient(conf *Config) *Client

NewClient creates a new instance of Client.

func (*Client) Close

func (c *Client) Close(ctx context.Context) error

Close all resources of this client.

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, name string) (*types.ProjectInfo, error)

CreateProject creates a new project of the given name.

func (*Client) CreateTemplate

func (c *Client) CreateTemplate(ctx context.Context, name, contents string) (*types.TemplateInfo, error)

CreateTemplate creates a new template.

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, id types.ID) error

DeleteProject deletes the given project.

func (*Client) Dial

func (c *Client) Dial(ctx context.Context) error

Dial creates an instance of Client and dials the given MongoDB.

func (*Client) FindProject

func (c *Client) FindProject(ctx context.Context, id types.ID) (*types.ProjectInfo, error)

FindProject returns the project of the given ID.

func (*Client) FindTemplate

func (c *Client) FindTemplate(ctx context.Context, id types.ID) (*types.TemplateInfo, error)

FindTemplate returns the template of the given ID.

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context) ([]*types.ProjectInfo, error)

ListProjects returns the list of projects.

func (*Client) UpdateProject

func (c *Client) UpdateProject(ctx context.Context, id types.ID, name string) error

UpdateProject updates the given project.

type Config

type Config struct {
	ConnectionTimeoutSec time.Duration `json:"ConnectionTimeoutSec"`
	ConnectionURI        string        `json:"ConnectionURI"`
	Database             string        `json:"Database"`
	PingTimeoutSec       time.Duration `json:"PingTimeoutSec"`
}

Config is the configuration for creating a Client instance.

Jump to

Keyboard shortcuts

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