sonix v0.1.0 Sonix View Source
Highlevel API
Link to this section Summary
Functions
Count items in a collection, bucket or object
Flush a collection, bucket or object
Initializes Tcp Client Genserver
Pop a text
Push a text
Close a TCP connection
Query/Suggest a term
Start with a mode
Link to this section Functions
Link to this function
count(conn, opts \\ []) View Source
Count items in a collection, bucket or object
Parameters
- opts: default values are [collection: "", bucket: "", object: ""]
Examples
iex> Sonix.count(conn, [collection: "messages"])
1
Link to this function
flush(conn, opts \\ []) View Source
Flush a collection, bucket or object
Parameters
- opts: default values are [collection: "", bucket: "", object: ""]
Examples
iex> Sonix.flush(conn, [collection: "messages"])
1
Link to this function
init(host \\ {127, 0, 0, 1}, port \\ 1491) View Source
Initializes Tcp Client Genserver
Examples
iex> Sonix.init()
#PID<0.177.0>
Link to this function
pop(conn, opts \\ []) View Source
Pop a text
Parameters
- opts: default values are [collection: "", bucket: "default", object: "", term: ""]
Examples
iex> Sonix.pop(conn, [collection: "messages", object: "obj:1", "term": "spiderman"])
1
Link to this function
push(conn, opts \\ []) View Source
Push a text
Parameters
- opts: default values are [collection: "", bucket: "default", object: "", term: ""]
Examples
iex> Sonix.push(conn, [collection: "messages", object: "obj:1", "term": "spiderman is cool"])
:ok
Link to this function
quit(conn) View Source
Close a TCP connection
Examples
iex> Sonix.quit(conn)
:ok
Link to this function
search(conn, opts \\ []) View Source
Query/Suggest a term
Parameters
- opts: default values are [type: "QUERY", collection: "", bucket: "default", term: "", limit: 10, offset: 0]
Examples
iex> Sonix.search(conn, [type: "QUERY", collection: "messages", "term": "spiderman"])
obj:1
iex> Sonix.suggest(conn, [type: "SUGGEST", collection: "messages", "term": "spider"])
spiderman
Link to this function
start(conn, channel, password) View Source
Start with a mode
Examples
iex> Sonix.start(conn, "search", "SecretPassword")
:ok