Documentation ¶
Index ¶
- Constants
- Variables
- func LoadDataFromDoc(b []byte, encs *encoder.Encoders) (bson.Raw, interface{}, error)
- func NewLastManifestDoc(height base.Height, enc encoder.Encoder) (lastManifestDoc, error)
- type BaseDoc
- type BaseDocUnmarshaler
- type Client
- func (cl *Client) Add(col string, doc Doc) (interface{}, error)
- func (cl *Client) AddRaw(col string, raw bson.Raw) (interface{}, error)
- func (cl *Client) Bulk(ctx context.Context, col string, models []mongo.WriteModel, order bool) error
- func (cl *Client) Close() error
- func (cl *Client) Collection(col string) *mongo.Collection
- func (cl *Client) Collections() ([]string, error)
- func (cl *Client) CopyCollection(source *Client, fromCol, toCol string) error
- func (cl *Client) Count(ctx context.Context, col string, filter interface{}, ...) (int64, error)
- func (cl *Client) Database(db string) *mongo.Database
- func (cl *Client) Databases(filter interface{}) ([]string, error)
- func (cl *Client) Delete(col string, filter bson.D, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (cl *Client) DropDatabase() error
- func (cl *Client) Exists(col string, filter bson.D) (bool, error)
- func (cl *Client) Find(ctx context.Context, col string, query interface{}, ...) error
- func (cl *Client) GetByFilter(col string, filter bson.D, callback getRecordCallback, ...) error
- func (cl *Client) GetByID(col string, id interface{}, callback getRecordCallback, ...) error
- func (cl *Client) New(db string) (*Client, error)
- func (cl *Client) Raw() *mongo.Client
- func (cl *Client) Set(col string, doc Doc) (interface{}, error)
- func (cl *Client) WithSession(...) (interface{}, error)
- type Database
- func (st *Database) Clean() error
- func (st *Database) Client() *Client
- func (st *Database) Close() error
- func (st *Database) CreateIndex(col string, models []mongo.IndexModel, prefix string) error
- func (st *Database) Encoder() encoder.Encoder
- func (st *Database) Encoders() *encoder.Encoders
- func (st *Database) Info(key string) ([]byte, bool, error)
- func (st *Database) Initialize() error
- func (st *Database) New() (*Database, error)
- func (st *Database) Readonly() (*Database, error)
- func (st *Database) SetInfo(key string, b []byte) error
- type Doc
- type InfoDoc
Constants ¶
View Source
const ( ColNameInfo = "info" ColNameManifest = "manifest" // ColNameOperation = "operation" // ColNameStagedOperation = "staged_operation" // ColNameProposal = "proposal" // ColNameState = "state" // ColNameVoteproof = "voteproof" ColNameBlockdataMap = "blockdata_map" )
Variables ¶
View Source
var IndexPrefix = "mitum_"
Functions ¶
func LoadDataFromDoc ¶
Types ¶
type BaseDocUnmarshaler ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Collection ¶
func (cl *Client) Collection(col string) *mongo.Collection
func (*Client) Collections ¶
func (*Client) CopyCollection ¶
func (*Client) Delete ¶
func (cl *Client) Delete(col string, filter bson.D, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*Client) DropDatabase ¶
func (*Client) GetByFilter ¶
func (*Client) GetByID ¶
func (cl *Client) GetByID( col string, id interface{}, callback getRecordCallback, opts ...*options.FindOneOptions, ) error
func (*Client) WithSession ¶
func (cl *Client) WithSession( callback func(mongo.SessionContext, func(string) *mongo.Collection) (interface{}, error), ) (interface{}, error)
type Database ¶
func NewDatabase ¶
func NewDatabaseFromURI ¶
func (*Database) Clean ¶
Clean will drop the existing collections. To keep safe the another collections by user, drop collections instead of drop database.
func (*Database) CreateIndex ¶
func (*Database) Initialize ¶
Click to show internal directories.
Click to hide internal directories.