XU XUv0.8.8
中文

API

#github.com/xulang-org/packages/neo4j

import: neo4j #github.com/xulang-org/packages/neo4j

counts: 3 fns, 8 methods, 2 types, 0 consts, 0 ifaces

Neo4j Graph Database Native Client for Xu Communicates directly with Neo4j via HTTP Cypher Transactional API.

github.com/xulang-org/packages · 0.1.1 · Install and use

struct Neo4jClient

XuAPI
pub struct Neo4jClient {
    pub host string
    pub port int
    pub user string
    pub password string
    pub database string
    pub auth_header string
}

Purpose

Public struct `Neo4jClient`.

Parameters

host string
host
port int
port
user string
field (string)
password string
field (string)
database string
field (string)
auth_header string
field (string)

new_client

XuAPI
pub fn new_client(endpoint string, user string, pass string, db string) Neo4jClient

Purpose

Construct client.

Parameters

endpoint string
endpoint (string)
user string
user (string)
pass string
pass (string)
db string
db (string)

Returns

Neo4jClient — a value of this type

(Neo4jClient) execute

XuAPI
pub fn (c Neo4jClient) execute(stmt string) string

Purpose

Call `execute` on `Neo4jClient`. Throws on failure.

Parameters

c Neo4jClient
receiver Neo4jClient (value receiver)
stmt string
stmt (string)

Returns

string — result string

(Neo4jClient) execute_on_fd

XuAPI
pub fn (c Neo4jClient) execute_on_fd(fd int, stmt string, keep_alive bool) string

Purpose

Method on `Neo4jClient`: execute on fd. Throws on failure.

Parameters

c Neo4jClient
receiver Neo4jClient (value receiver)
fd int
file descriptor (int)
stmt string
stmt (string)
keep_alive bool
keep_alive (bool)

Returns

string — result string

struct Pool

XuAPI
pub struct Pool {
    pub client Neo4jClient
    pub state chan pool.State
    pub max_idle int
}

Purpose

Public struct `Pool`.

Parameters

client Neo4jClient
field (Neo4jClient)
state chan pool.State
field (channel; type chan pool.State)
max_idle int
field (int)

new_pool

XuAPI
pub fn new_pool(endpoint string, user string, pass string, db string, max_idle int) Pool

Purpose

Construct pool.

Parameters

endpoint string
endpoint (string)
user string
user (string)
pass string
pass (string)
db string
db (string)
max_idle int
max_idle (int)

Returns

Pool — a value of this type

(&Pool) dup

XuAPI
pub fn (p &Pool) dup() Pool

Purpose

Copies configuration while sharing the connection and close lifecycle.

Parameters

p &Pool
receiver &Pool (borrow)

Returns

Pool — a value of this type

(&Pool) get_conn

XuAPI
pub fn (p &Pool) get_conn() int

Purpose

Method on `&Pool`: read conn.

Parameters

p &Pool
receiver &Pool (borrow)

Returns

int — a value of this type

(&Pool) put_conn

XuAPI
pub fn (p &Pool) put_conn(fd int)

Purpose

Method on `&Pool`: put connection.

Parameters

p &Pool
receiver &Pool (borrow)
fd int
file descriptor (int)

(&Pool) discard_conn

XuAPI
pub fn (p &Pool) discard_conn(fd int)

Purpose

Method on `&Pool`: discard connection.

Parameters

p &Pool
receiver &Pool (borrow)
fd int
file descriptor (int)

open_pool

XuAPI
pub fn open_pool(endpoint string, user string, pass string, db string, max_idle int) Pool

Purpose

Open pool.

Parameters

endpoint string
endpoint (string)
user string
user (string)
pass string
pass (string)
db string
db (string)
max_idle int
max_idle (int)

Returns

Pool — a value of this type

(&Pool) execute

XuAPI
pub fn (p &Pool) execute(stmt string) string

Purpose

Call `execute` on `&Pool`. Throws on failure.

Parameters

p &Pool
receiver &Pool (borrow)
stmt string
stmt (string)

Returns

string — result string

(&Pool) close

XuAPI
pub fn (p &Pool) close()

Purpose

Method on `&Pool`: close the resource.

Parameters

p &Pool
receiver &Pool (borrow)