Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collection ¶
type Collection interface { FindOne(ctx context.Context, filter any) FindOneResult UpdateOne(ctx context.Context, filter, update any) (UpdateResult, error) DeleteOne(ctx context.Context, filter any) (DeleteResult, error) }
Collection interface represents the minimal collection interface needed for ULID operations This allows the package to work with different collection implementations
type DeleteResult ¶
type DeleteResult struct {
DeletedCount int64
}
DeleteResult represents the result of a delete operation
func DeleteByObjectID ¶
func DeleteByObjectID(ctx context.Context, coll Collection, id any) (DeleteResult, error)
DeleteByObjectID deletes a document by its ObjectID
func DeleteByULID ¶
func DeleteByULID(ctx context.Context, coll Collection, id string) (DeleteResult, error)
DeleteByULID deletes a document by its ULID
type FindOneResult ¶
FindOneResult interface represents the result of a FindOne operation
func FindByObjectID ¶
func FindByObjectID(ctx context.Context, coll Collection, id any) FindOneResult
FindByObjectID finds a document by its ObjectID
func FindByULID ¶
func FindByULID(ctx context.Context, coll Collection, id string) FindOneResult
FindByULID finds a document by its ULID
type ULID ¶
type ULID struct {
// contains filtered or unexported fields
}
ULID represents a ULID identifier with helper methods
type UpdateResult ¶
type UpdateResult struct { MatchedCount int64 ModifiedCount int64 UpsertedCount int64 UpsertedID any }
UpdateResult represents the result of an update operation
func UpdateByObjectID ¶
func UpdateByObjectID(ctx context.Context, coll Collection, id any, updateDoc *update.Builder) (UpdateResult, error)
UpdateByObjectID updates a document by its ObjectID
func UpdateByULID ¶
func UpdateByULID(ctx context.Context, coll Collection, id string, updateDoc *update.Builder) (UpdateResult, error)
UpdateByULID updates a document by its ULID