mongorpcgo

package module
v0.0.0-...-ff98fbf Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

mongorpc-go

A Go Client implementation of the MongoRPC with Synthetic Sugar Syntex.

Example

// Initilize database
db := client.Database("sample_mflix")

// List Collections
collections, err := db.ListCollectionNames(context.TODO())
if err != nil {
  fmt.Println(err)
}
fmt.Println(collections)

// Get Document By ID
doc, err := db.Collection("movies").Document("573a13b0f29313caabd35231").Get(context.TODO())
if err != nil {
  fmt.Println(err)
}
fmt.Println(doc)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

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

func (*Collection) Document

func (coll *Collection) Document(documentID string) *Document

Initilize the document with the document id.

type Database

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

func (*Database) Collection

func (db *Database) Collection(name string) *Collection

Initilize a new collection

func (*Database) ListCollectionNames

func (db *Database) ListCollectionNames(ctx context.Context) ([]string, error)

List collections in the database

type Document

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

Document is a wrapper for a document in a collection.

func (*Document) Get

func (doc *Document) Get(ctx context.Context) (interface{}, error)

Get returns the document with the given id.

type MongoRPCClient

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

func NewClient

func NewClient(address string) *MongoRPCClient

func (*MongoRPCClient) Connect

func (c *MongoRPCClient) Connect(opts ...grpc.DialOption) (*grpc.ClientConn, error)

func (*MongoRPCClient) Database

func (client *MongoRPCClient) Database(name string) *Database

Initiliaze a new database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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