Mojo · Documents

Documents

from ustore import FieldType, Modification, Gist, … 1.0.0-rc.1 · d6d40961

API

StructFieldTypeThe type of a document, or of a value extracted from one, ustore_docs_field_type_t.
struct FieldType

Fields

codec_intThe raw ustore_docs_field_type_t value the ABI exchanges.

Values

JSONFieldType(Int32(0))JSON text.
NULLFieldType(Int32(10))The JSON null.
BOOLFieldType(Int32(11))A boolean.
UUIDFieldType(Int32(12))A 128-bit UUID.
F16FieldType(Int32(40))A 16-bit float.
F32FieldType(Int32(41))A 32-bit float.
F64FieldType(Int32(42))A 64-bit float.
I8FieldType(Int32(20))A signed 8-bit integer.
I16FieldType(Int32(21))A signed 16-bit integer.
I32FieldType(Int32(22))A signed 32-bit integer.
I64FieldType(Int32(23))A signed 64-bit integer.
U8FieldType(Int32(30))An unsigned 8-bit integer.
U16FieldType(Int32(31))An unsigned 16-bit integer.
U32FieldType(Int32(32))An unsigned 32-bit integer.
U64FieldType(Int32(33))An unsigned 64-bit integer.
BINARYFieldType(Int32(50))The text of a value without a null terminator.
STRINGFieldType(Int32(51))A value printed as text.

Conforms to

Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassable
StructModificationThe modification a documents write applies, ustore_docs_modification_t.
struct Modification

Fields

codec_intThe raw ustore_docs_modification_t value the ABI exchanges.

Values

UPSERTModification(Int32(0))Insert or replace.
UPDATEModification(Int32(1))Replace an existing document or field.
INSERTModification(Int32(2))Insert a document or field that does not exist yet.
PATCHModification(Int32(3))Apply an RFC 6902 patch.
MERGEModification(Int32(4))Apply an RFC 7386 merge.

Conforms to

Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassable
StructGistThe unique paths to the leaves of the requested documents, read in place from the arena a gist borrows.3
struct Gist[origin: MutOrigin]

Parameters

originMutOrigincomptimeThe arena the paths live in, which this result borrows.

Fields

arenaPointer[Arena, origin]The arena holding the paths.
generationIntThe arena's call the paths came from.
writtenGistWrittenThe views the engine wrote.

Values

WrittenGistWritten

Conforms to

Answer, Deinitable, Movable, Sized
__init__
def __init__(out self, arena: Int, generation: Int, written: GistWritten, count: Int)
__len__The unique paths.
def __len__(self) -> Int
fieldsThe paths as JSON Pointers.
def fields(self) -> Tape[origin]
StructColumnOne gathered field over every document, as an Apache Arrow array of its type.6
struct Column[origin: MutOrigin]

Parameters

originMutOrigincomptimeThe arena the column lives in, which this result borrows.

Fields

arenaPointer[Arena, origin]The arena holding the column.
generationIntThe arena's call the column came from.
viewColumnViewArgumentsThe bitmaps, scalars and strings the engine wrote.
countIntRows, one per document.

Conforms to

Copyable, Deinitable, ImplicitlyCopyable, Movable, Sized
__len__The rows, one per document.
def __len__(self) -> Int
validWhether the row's value was found and converted.
def valid(self, row: Int) -> Bool
convertedWhether the conversion changed the row's semantics, as parsing a string into an integer does.
def converted(self, row: Int) -> Bool
collidesWhether a value of an inconvertible type sits under the field in that row.
def collides(self, row: Int) -> Bool
scalarsThe scalars of a scalar column, read as dtype, which must match the requested type's width.
def scalars[dtype: DType](ref self) -> Span[Scalar[dtype], origin_of(self)]
stringsThe strings of a string column.
def strings(self) -> Tape[origin]
StructColumnsEvery gathered field of every document, one column per field, read in place from the arena a gather borrows.3
struct Columns[origin: MutOrigin]

Parameters

originMutOrigincomptimeThe arena the columns live in, which this result borrows.

Fields

arenaPointer[Arena, origin]The arena holding the columns.
generationIntThe arena's call the columns came from.
writtenColumnsWrittenThe views the engine wrote.
countIntRows, one per document.

Values

WrittenColumnsWritten

Conforms to

Answer, Deinitable, Movable, Sized
__init__
def __init__(out self, arena: Int, generation: Int, written: ColumnsWritten, count: Int)
__len__The columns, one per field.
def __len__(self) -> Int
columnThe column of field field.
def column(self, field: Int) -> Column[origin]
StructDocsWriteConfigWhere inside the documents a write lands, how its values read, and how it applies.1
struct DocsWriteConfig[fields_origin: ImmOrigin = ImmUntrackedOrigin, id_origin: ImmOrigin = ImmUntrackedOrigin]

Parameters

fields_originImmOrigincomptimeThe borrowed fields.
id_originImmOrigincomptimeThe borrowed name of the key field.

Fields

fieldsStringsView[fields_origin]Fields to modify inside the documents, one per task; zeroed modifies whole documents.
id_fieldBytesView[id_origin]Field holding every document's key when no keys are given, such as "_id".
typeFieldTypeFormat of the written values.
modificationModificationModification applied to every document.
durabilityDurabilityHow durable the writes are once the call finishes at the head.

Conforms to

Copyable, Deinitable, ImplicitlyCopyable, Movable
__init__Names only the knobs that differ from the defaults.
def __init__(
    out self,
    *,
    fields: StringsView[fields_origin] = StringsView(),
    id_field: BytesView[id_origin] = BytesView(),
    type: FieldType = FieldType.JSON,
    modification: Modification = Modification.UPSERT,
    durability: Durability = Durability.BUFFERED
)
StructDocsReadConfigWhere inside the documents a read looks, and what it exports.1
struct DocsReadConfig[fields_origin: ImmOrigin = ImmUntrackedOrigin]

Parameters

fields_originImmOrigincomptimeThe borrowed fields.

Fields

fieldsStringsView[fields_origin]Fields to read inside the documents, one per task; zeroed reads whole documents.
outputs_typeFieldTypeFormat the values are exported in, JSON or STRING.
valuesBoolWhether the bytes come too, or only presences and lengths.

Conforms to

Copyable, Deinitable, ImplicitlyCopyable, Movable
__init__Names only the knobs that differ from the defaults.
def __init__(
    out self,
    *,
    fields: StringsView[fields_origin] = StringsView(),
    outputs_type: FieldType = FieldType.JSON,
    values: Bool = True
)