struct Response
pub struct Response {
pub status_code int
pub headers string
pub body string
}Purpose
Public struct `Response`.
Parameters
status_codeint- field (int)
headersstring- field (string)
bodystring- body
API
#github.com/xulang-org/packages/chromaChroma AI Vector Database Client for Xu Supports collection management, document and vector embedding storage, and similarity search.
github.com/xulang-org/packages · 0.1.1 · Install and use
struct Responsepub struct Response {
pub status_code int
pub headers string
pub body string
}Public struct `Response`.
status_code intheaders stringbody stringstruct Clientpub struct Client {
pub host string
pub port int
pub tenant string
pub database string
}Public struct `Client`.
host stringport inttenant stringdatabase stringnew_clientpub fn new_client(endpoint string) ClientConstruct client.
endpoint stringClient — a value of this type
(Client) requestpub fn (c Client) request(method string, path string, body string) ResponseCall `request` on `Client`. Throws on failure.
c Clientmethod stringpath stringbody stringResponse — a value of this type
(Client) heartbeatpub fn (c Client) heartbeat() boolCall `heartbeat` on `Client`.
c Clientbool — true or false
(Client) create_collectionpub fn (c Client) create_collection(name string) stringMethod on `Client`: create collection. Throws on failure.
c Clientname stringstring — result string
(Client) addpub fn (c Client) add(col_id string, ids_json string, embeddings_json string, documents_json string) boolMethod on `Client`: add.
c Clientcol_id stringids_json stringembeddings_json stringdocuments_json stringbool — true or false
(Client) querypub fn (c Client) query(col_id string, query_embeddings_json string, n_results int) stringCall `query` on `Client`. Throws on failure.
c Clientcol_id stringquery_embeddings_json stringn_results intstring — result string
(Client) delete_collectionpub fn (c Client) delete_collection(name string) boolMethod on `Client`: delete collection.
c Clientname stringbool — true or false
struct Poolpub struct Pool {
pub client Client
pub state chan pool.State
pub max_idle int
}Public struct `Pool`.
client Clientstate chan pool.Statemax_idle intnew_poolpub fn new_pool(endpoint string, max_idle int) PoolConstruct pool.
endpoint stringmax_idle intPool — a value of this type
(&Pool) duppub fn (p &Pool) dup() PoolCopies configuration while sharing the connection and close lifecycle.
p &PoolPool — a value of this type
(&Pool) get_connpub fn (p &Pool) get_conn() intMethod on `&Pool`: read conn.
p &Poolint — a value of this type
(&Pool) put_connpub fn (p &Pool) put_conn(fd int)Method on `&Pool`: put connection.
p &Poolfd int(&Pool) discard_connpub fn (p &Pool) discard_conn(fd int)Method on `&Pool`: discard connection.
p &Poolfd intopen_poolpub fn open_pool(endpoint string, max_idle int) PoolOpen pool.
endpoint stringmax_idle intPool — a value of this type
(&Pool) heartbeatpub fn (p &Pool) heartbeat() boolCall `heartbeat` on `&Pool`.
p &Poolbool — true or false
(&Pool) create_collectionpub fn (p &Pool) create_collection(name string) stringMethod on `&Pool`: create collection. Throws on failure.
p &Poolname stringstring — result string
(&Pool) addpub fn (p &Pool) add(col_id string, ids_json string, embeddings_json string, documents_json string) boolMethod on `&Pool`: add.
p &Poolcol_id stringids_json stringembeddings_json stringdocuments_json stringbool — true or false
(&Pool) querypub fn (p &Pool) query(col_id string, query_embeddings_json string, n_results int) stringCall `query` on `&Pool`. Throws on failure.
p &Poolcol_id stringquery_embeddings_json stringn_results intstring — result string
(&Pool) delete_collectionpub fn (p &Pool) delete_collection(name string) boolMethod on `&Pool`: delete collection.
p &Poolname stringbool — true or false
(&Pool) closepub fn (p &Pool) close()Method on `&Pool`: close the resource.
p &Pool