Module box
As well as executing Lua chunks or defining your own functions, you can exploit
Tarantool’s storage functionality with the box
module and its submodules.
Every submodule contains one or more Lua functions. A few submodules contain members as well as functions. The functions allow data definition (create alter drop), data manipulation (insert delete update upsert select replace), and introspection (inspecting contents of spaces, accessing server configuration).
To catch errors that functions in box
submodules may throw, use pcall.
The contents of the box
module can be inspected at runtime
with box
, with no arguments. The box
module contains:
- Submodule
box.stat
- Submodule
box.cfg
- Submodule box.backup
- Submodule
box.ctl
- Submodule
box.error
- Submodule
box.index
- Examples for
box.index
- index_object:unique
- index_object:type
- index_object:parts()
- index_object:pairs()
- index_object:select()
- index_object:get()
- index_object:min()
- index_object:max()
- index_object:random()
- index_object:count()
- index_object:update()
- index_object:delete()
- index_object:alter()
- index_object:drop()
- index_object:rename()
- index_object:bsize()
- index_object:stat()
- index_object:compact()
- index_object:user_defined()
- Examples for
- Submodule
box.info
- Submodule
box.schema
- box.schema.space.create() / schema_object:create_space()
- box.schema.upgrade()
- box.schema.user.create()
- box.schema.user.drop()
- box.schema.user.exists()
- box.schema.user.grant()
- box.schema.user.revoke()
- box.schema.user.password()
- box.schema.user.passwd()
- box.schema.user.info()
- box.schema.role.create()
- box.schema.role.drop()
- box.schema.role.exists()
- box.schema.role.grant()
- box.schema.role.revoke()
- box.schema.role.info()
- box.schema.func.create()
- box.schema.func.drop()
- box.schema.func.exists()
- box.schema.func.reload()
- Sequences
- Submodule
box.session
- box.session.id()
- box.session.exists()
- box.session.peer()
- box.session.sync()
- box.session.user()
- box.session.type()
- box.session.su()
- box.session.uid()
- box.session.euid()
- box.session.storage
- box.session.on_connect()
- box.session.on_disconnect()
- box.session.on_auth()
- box.session.on_access_denied()
- box.session.push()
- Submodule
box.slab
- Submodule
box.space
- Examples
- space_object:auto_increment()
- space_object:bsize()
- space_object:count()
- space_object:create_index()
- space_object:delete()
- space_object:drop()
- space_object:format()
- space_object:frommap()
- space_object:get()
- space_object:insert()
- space_object:len()
- space_object:on_replace()
- space_object:before_replace()
- space_object:pairs()
- space_object:put()
- space_object:rename()
- space_object:replace() / put()
- space_object:run_triggers()
- space_object:select()
- space_object:truncate()
- space_object:update()
- space_object:upsert()
- space_object:user_defined()
- space_object:enabled
- space_object:field_count
- space_object:id
- space_object:index
- box.space._cluster
- box.space._func
- box.space._index
- box.space._vindex
- box.space._priv
- box.space._vpriv
- box.space._schema
- box.space._sequence
- box.space._sequence_data
- box.space._space
- box.space._vspace
- box.space._user
- box.space._vuser
- Submodule
box.tuple
- box.tuple.new()
- #tuple_object
- box.tuple.bsize()
- tuple_object[field-number]
- tuple_object[field-name]
- tuple_object[field-path]
- tuple_object:find(), tuple_object:findall()
- tuple_object:next()
- tuple_object:pairs(), tuple_object:ipairs()
- tuple_object:totable()
- tuple_object:tomap()
- tuple_object:transform()
- tuple_object:unpack()
- tuple_object:update()
- tuple_object:upsert()
- How to convert tuples to/from Lua tables
- Functions for transaction management
- Function
box.once
- Function
box.snapshot
- Constant
box.NULL