struct C0::Document

Overview

Zero-copy navigator for a full C0DATA document.

Walks an entire buffer containing FS/GS/RS/US structure and provides access to files, groups, records, and fields as slices into the original buffer.

Example: doc = C0::Document.new(buf) doc.name # => "mydb" doc.groups.size # => 2 doc.group("users") # => Group doc.group("users").table # => Table doc["users"] # => Group (shortcut)

Defined in:

c0/document.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(buf : Bytes) #

[View source]

Instance Method Detail

def [](name : String) : Group #

Shortcut for group by name.


[View source]
def [](i : Int32) : Group #

Shortcut for group by index.


[View source]
def each_group(& : Group -> ) : Nil #

Iterate all groups.


[View source]
def group(i : Int32) : Group #

Access a group by index.


[View source]
def group(name : String) : Group #

Access a group by name.


[View source]
def group_count : Int32 #

Number of top-level groups.


[View source]
def group_names : Array(Bytes) #

All group names.


[View source]
def name : Bytes #

Document/file name (text after FS). Empty if no FS present.


[View source]