truncate command deletes all records from specified table.
truncate command takes only one parameter.
The required parameter is only table:
truncate table
Here is a simple example of truncate command.
Execution example:
table_create Users TABLE_PAT_KEY ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
load --table Users
[
{"_key": "Alice", "score": 2},
{"_key": "Bob", "score": 0},
{"_key": "Carlos", "score": -1}
]
# [[0, 1337566253.89858, 0.000355720520019531], 3]
select Users
# [
# [
# 0,
# 1337566253.89858,
# 0.000355720520019531
# ],
# [
# [
# [
# 3
# ],
# [
# [
# "_id",
# "UInt32"
# ],
# [
# "_key",
# "ShortText"
# ]
# ],
# [
# 1,
# "Alice"
# ],
# [
# 2,
# "Bob"
# ],
# [
# 3,
# "Carlos"
# ]
# ]
# ]
# ]
truncate Users
# [[0, 1337566253.89858, 0.000355720520019531], true]
select Users
# [
# [
# 0,
# 1337566253.89858,
# 0.000355720520019531
# ],
# [
# [
# [
# 0
# ],
# [
# [
# "_id",
# "UInt32"
# ],
# [
# "_key",
# "ShortText"
# ]
# ]
# ]
# ]
# ]
This section describes parameters of truncate.
[HEADER, SUCCEEDED_OR_NOT]
HEADER
See Output format about HEADER.
SUCCEEDED_OR_NOT
If command succeeded, it returns true, otherwise it returns false on error.