Documentation
¶
Index ¶
- func CollapseMainDatabaseName() string
- func CollapseMongoURISecret(uri string) (string, error)
- func CollapseURIFor(purpose PurposeAffinity) (string, error)
- func MaskMongoURI(uri string) string
- type Aggregation
- func (a Aggregation) AddFields(field bson.D) Aggregation
- func (a Aggregation) AppendFrom(agg Aggregation) Aggregation
- func (a Aggregation) Group(group bson.D) Aggregation
- func (a Aggregation) JsonString() string
- func (a Aggregation) Limit(value int64) Aggregation
- func (a Aggregation) Log() slog.Attr
- func (a Aggregation) Lookup(lookup bson.D) Aggregation
- func (a Aggregation) Match(filter bson.D) Aggregation
- func (a Aggregation) Pipeline() mongo.Pipeline
- func (a Aggregation) Project(fields bson.D) Aggregation
- func (a Aggregation) Search(fields bson.D) Aggregation
- func (a Aggregation) Sort(fields bson.D) Aggregation
- type Collapsible
- type Dataverse
- type Detectable
- type Detector
- func (r *Detector[T]) Filter(filters ...expression.QueryFieldPredicate) *Detector[T]
- func (r *Detector[T]) FilterEither(filters ...expression.QueryFieldPredicate) *Detector[T]
- func (r *Detector[T]) Limit(limit int64) *Detector[T]
- func (r *Detector[T]) PipelineJSON() string
- func (r Detector[T]) PullAll(ctx context.Context) ([]T, error)
- func (r *Detector[T]) PullOne(ctx context.Context) (*T, error)
- func (r Detector[T]) RunPipeline(ctx context.Context, postStages Aggregation) (*mongo.Cursor, error)
- func (r *Detector[T]) Sort(field string, descending bool) *Detector[T]
- func (r *Detector[T]) SortLatest() *Detector[T]
- type EntityField
- func (q EntityField) Eq(value any) expression.QueryFieldPredicate
- func (q EntityField) Gt(value any) expression.QueryFieldPredicate
- func (q EntityField) Gte(value any) expression.QueryFieldPredicate
- func (q EntityField) ID() EntityIDField
- func (q EntityField) In(values ...any) expression.QueryFieldPredicate
- func (q EntityField) Lt(value any) expression.QueryFieldPredicate
- func (q EntityField) Lte(value any) expression.QueryFieldPredicate
- func (q EntityField) Ne(value any) expression.QueryFieldPredicate
- func (q EntityField) Nin(values ...any) expression.QueryFieldPredicate
- func (q EntityField) Str() EntityStringField
- func (q EntityField) ToQueryPredicate(queryOp expression.QueryOp) expression.QueryFieldPredicate
- type EntityIDField
- type EntityStringField
- type Member
- type MemberResponsibility
- type MembersInfoResponse
- type MongoDataverse
- func (m *MongoDataverse) AdminDatabase() *mongo.Database
- func (m *MongoDataverse) BranchDatabase(branchName string) *mongo.Database
- func (m *MongoDataverse) Client() *mongo.Client
- func (m *MongoDataverse) Close()
- func (m *MongoDataverse) Collection(name string) *mongo.Collection
- func (m *MongoDataverse) Connect() (*mongo.Client, error)
- func (m *MongoDataverse) ListMembers() (*MembersInfoResponse, error)
- func (m *MongoDataverse) MainDatabase() *mongo.Database
- func (m *MongoDataverse) ReelectPrimary() error
- func (m *MongoDataverse) RemoveMember(name string) error
- func (m *MongoDataverse) Status() (*MongoStatus, error)
- func (m *MongoDataverse) UpdateMember(name string, newPassword string, responsibility MemberResponsibility, ...) error
- type MongoMember
- type MongoRole
- type MongoStatus
- type Observer
- type PurposeAffinity
- type RSStatus
- type Ripple
- func (r *Ripple) DoAddToSet(key string, value any) *Ripple
- func (r *Ripple) DoIncr(key string, value int) *Ripple
- func (r *Ripple) DoOperation(operation string, key string, value any) *Ripple
- func (r *Ripple) DoSetOnInsert(key string, value any) *Ripple
- func (r *Ripple) Get(key string) (any, bool)
- func (r Ripple) GetID() bson.ObjectID
- func (r *Ripple) GetOnInsertFor(key string, defaultValue any) any
- func (r *Ripple) Set(key string, value any) *Ripple
- func (r Ripple) WasInserted() bool
- type RippleState
- type ServerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollapseMainDatabaseName ¶
func CollapseMainDatabaseName() string
func CollapseMongoURISecret ¶
func CollapseURIFor ¶
func CollapseURIFor(purpose PurposeAffinity) (string, error)
func MaskMongoURI ¶
Types ¶
type Aggregation ¶
type Aggregation struct {
// contains filtered or unexported fields
}
func (Aggregation) AddFields ¶
func (a Aggregation) AddFields(field bson.D) Aggregation
func (Aggregation) AppendFrom ¶
func (a Aggregation) AppendFrom(agg Aggregation) Aggregation
func (Aggregation) Group ¶
func (a Aggregation) Group(group bson.D) Aggregation
func (Aggregation) Limit ¶
func (a Aggregation) Limit(value int64) Aggregation
func (Aggregation) Log ¶
func (a Aggregation) Log() slog.Attr
func (Aggregation) Lookup ¶
func (a Aggregation) Lookup(lookup bson.D) Aggregation
func (Aggregation) Match ¶
func (a Aggregation) Match(filter bson.D) Aggregation
func (Aggregation) Pipeline ¶
func (a Aggregation) Pipeline() mongo.Pipeline
func (Aggregation) Project ¶
func (a Aggregation) Project(fields bson.D) Aggregation
func (Aggregation) Search ¶
func (a Aggregation) Search(fields bson.D) Aggregation
func (Aggregation) Sort ¶
func (a Aggregation) Sort(fields bson.D) Aggregation
type Collapsible ¶
type Collapsible interface {
CollapseID() bson.ObjectID
HasID() bool
SelfScope() expression.Scope //return the scope of Self. The scope should have enough information to UNIQUELY filter itself
//An entity must be Collapse by an observer and Decohere the interaction's ripple in order to exists in a known state.
//Failure to complete Collapse AND Decohere flow will put the state of the object in an UNKNOWN / INBETWEEN state.
Collapse() Ripple //return the ripple side effect after the collapse. Once Collapse is called the model is in an INBETWEEN state
Decohere(ripple Ripple) error //After the collapse and interaction with environment, an entity decoheres (ripple contains materialization info)
}
type Dataverse ¶ added in v1.4.1
func (*Dataverse) DataCollection ¶ added in v1.4.1
func (e *Dataverse) DataCollection() *mongo.Collection
type Detectable ¶
type Detector ¶ added in v1.4.1
type Detector[T Detectable] struct { Dataverse // contains filtered or unexported fields }
func NewDetector ¶ added in v1.4.1
func NewDetector[T Detectable]() *Detector[T]
func (*Detector[T]) Filter ¶ added in v1.4.1
func (r *Detector[T]) Filter(filters ...expression.QueryFieldPredicate) *Detector[T]
func (*Detector[T]) FilterEither ¶ added in v1.4.1
func (r *Detector[T]) FilterEither(filters ...expression.QueryFieldPredicate) *Detector[T]
func (*Detector[T]) PipelineJSON ¶ added in v1.4.1
func (Detector[T]) RunPipeline ¶ added in v1.4.1
func (*Detector[T]) SortLatest ¶ added in v1.4.1
type EntityField ¶
type EntityField struct {
Name string
}
func (EntityField) Eq ¶
func (q EntityField) Eq(value any) expression.QueryFieldPredicate
func (EntityField) Gt ¶
func (q EntityField) Gt(value any) expression.QueryFieldPredicate
func (EntityField) Gte ¶
func (q EntityField) Gte(value any) expression.QueryFieldPredicate
func (EntityField) ID ¶
func (q EntityField) ID() EntityIDField
func (EntityField) In ¶
func (q EntityField) In(values ...any) expression.QueryFieldPredicate
func (EntityField) Lt ¶
func (q EntityField) Lt(value any) expression.QueryFieldPredicate
func (EntityField) Lte ¶
func (q EntityField) Lte(value any) expression.QueryFieldPredicate
func (EntityField) Ne ¶
func (q EntityField) Ne(value any) expression.QueryFieldPredicate
func (EntityField) Nin ¶
func (q EntityField) Nin(values ...any) expression.QueryFieldPredicate
func (EntityField) Str ¶
func (q EntityField) Str() EntityStringField
func (EntityField) ToQueryPredicate ¶
func (q EntityField) ToQueryPredicate(queryOp expression.QueryOp) expression.QueryFieldPredicate
type EntityIDField ¶
type EntityIDField struct {
EntityField
}
func (EntityIDField) In ¶
func (q EntityIDField) In(values ...bson.ObjectID) expression.QueryFieldPredicate
--- Entity ID Field ---
func (EntityIDField) Nin ¶
func (q EntityIDField) Nin(values ...bson.ObjectID) expression.QueryFieldPredicate
type EntityStringField ¶
type EntityStringField struct {
EntityField
}
func (EntityStringField) In ¶
func (q EntityStringField) In(values ...string) expression.QueryFieldPredicate
func (EntityStringField) Nin ¶
func (q EntityStringField) Nin(values ...string) expression.QueryFieldPredicate
type Member ¶
type Member struct {
Name string `bson:"name"`
StateStr string `bson:"stateStr"`
OptimeDate time.Time `bson:"optimeDate"`
SyncSourceHost string `bson:"syncSourceHost"`
Health int `bson:"health"` // 1 for up, 0 for down
}
Member defines the individual node status in the replica set
type MemberResponsibility ¶
type MemberResponsibility struct {
ReadDbs []string
ReadWriteDbs []string
CreatorDbs []string
IsAdmin bool
}
func (*MemberResponsibility) ToMongoRoles ¶
func (r *MemberResponsibility) ToMongoRoles() []MongoRole
type MembersInfoResponse ¶
type MembersInfoResponse struct {
Users []MongoMember `bson:"users"`
}
type MongoDataverse ¶
type MongoDataverse struct {
// contains filtered or unexported fields
}
func SummonMongo ¶
func SummonMongo(purpose PurposeAffinity) *MongoDataverse
func (*MongoDataverse) AdminDatabase ¶
func (m *MongoDataverse) AdminDatabase() *mongo.Database
func (*MongoDataverse) BranchDatabase ¶
func (m *MongoDataverse) BranchDatabase(branchName string) *mongo.Database
func (*MongoDataverse) Client ¶
func (m *MongoDataverse) Client() *mongo.Client
func (*MongoDataverse) Close ¶
func (m *MongoDataverse) Close()
func (*MongoDataverse) Collection ¶
func (m *MongoDataverse) Collection(name string) *mongo.Collection
func (*MongoDataverse) ListMembers ¶
func (m *MongoDataverse) ListMembers() (*MembersInfoResponse, error)
func (*MongoDataverse) MainDatabase ¶
func (m *MongoDataverse) MainDatabase() *mongo.Database
func (*MongoDataverse) ReelectPrimary ¶
func (m *MongoDataverse) ReelectPrimary() error
func (*MongoDataverse) RemoveMember ¶
func (m *MongoDataverse) RemoveMember(name string) error
func (*MongoDataverse) Status ¶
func (m *MongoDataverse) Status() (*MongoStatus, error)
func (*MongoDataverse) UpdateMember ¶
func (m *MongoDataverse) UpdateMember(name string, newPassword string, responsibility MemberResponsibility, upsert bool) error
type MongoMember ¶
type MongoStatus ¶
type MongoStatus struct {
RSStatus RSStatus
ServerStatus ServerStatus
}
type Observer ¶ added in v1.4.1
type Observer[T Collapsible] struct { Dataverse }
func NewObserver ¶ added in v1.4.1
func NewObserver[T Collapsible]() *Observer[T]
type PurposeAffinity ¶
type PurposeAffinity int
const ( PurposeAffinityUnknown PurposeAffinity = iota PurposeAffinityAdmin PurposeAffinityCreator PurposeAffinityObserver PurposeAffinityCount //Max Count/Value for PurposeAffinity )
func (PurposeAffinity) String ¶
func (p PurposeAffinity) String() string
type Ripple ¶
type Ripple struct {
ID bson.ObjectID
State RippleState
Expr bson.D
Interstitial map[string]any //state during the period of transition.
InsertFeedback *mongo.InsertOneResult
UpdateFeedback *mongo.UpdateResult
}
func (*Ripple) DoAddToSet ¶ added in v1.4.10
func (*Ripple) DoOperation ¶ added in v1.4.5
func (*Ripple) DoSetOnInsert ¶ added in v1.4.5
func (Ripple) WasInserted ¶
type RippleState ¶
type RippleState int32
const ( RippleState_Unobservable RippleState = iota //failed state RippleState_FromUnknown //Forming into existence RippleState_FromKnown //Previously observed )
type ServerStatus ¶
type ServerStatus struct {
Uptime int64 `bson:"uptime"`
Connections struct {
Current int `bson:"current"`
Available int `bson:"available"`
} `bson:"connections"`
Opcounters struct {
Insert int64 `bson:"insert"`
Query int64 `bson:"query"`
Update int64 `bson:"update"`
Delete int64 `bson:"delete"`
Command int64 `bson:"command"`
} `bson:"opcounters"`
Mem struct {
Resident int64 `bson:"resident"` // in MB
Virtual int64 `bson:"virtual"`
} `bson:"mem"`
}
Click to show internal directories.
Click to hide internal directories.