Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 1.05 KB

README.md

File metadata and controls

54 lines (35 loc) · 1.05 KB

Build Status

Introduction

ClickHouse Swift client library.

Here is an example on how to use it:

Connection

import SwiftClickHouse;

do {
    // let conn = try Connection(); /// Will use defaults values
    let conn = try Connection(host : "localhost", port : 9000, database : "default", user : "default", password : "", compression : .Disable);
    

    // YOUR CODE HERE
}  catch ClickHouseError.Error(let code, let display_text, let exception) {
    print("\(errno) : \(error)");
} catch {
    print("Unknown error");
}

Query

if let result = try? connect.query(sql: "select * from test") {
    let row = result!.fetchRow()!;
    print(row["a"]!.double)
    print(result!.description);
}

Insert

let block = ClickHouseBlock();
block.append(name: "a", 100.500);

if let _ = try? connect.insert(table: "test", block: block) {
    // Success
}

Attention

Compression not implemented now.