Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benziahamed/swift-pilosa
Swift client for Pilosa
https://github.com/benziahamed/swift-pilosa
client pilosa swift
Last synced: 23 days ago
JSON representation
Swift client for Pilosa
- Host: GitHub
- URL: https://github.com/benziahamed/swift-pilosa
- Owner: BenziAhamed
- License: mit
- Created: 2017-05-22T13:49:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-22T16:34:30.000Z (over 7 years ago)
- Last Synced: 2024-10-12T04:34:19.785Z (3 months ago)
- Topics: client, pilosa, swift
- Language: Swift
- Size: 161 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Stories in Ready](https://badge.waffle.io/BenziAhamed/swift-pilosa.png?label=ready&title=Ready)](https://waffle.io/BenziAhamed/swift-pilosa?utm_source=badge)
# Swift client for Pilosa
> **NOTE**
> - This is an unofficial client library
> - This is a work in progressSwift client for [Pilosa](http://www.pilosa.com), a high performance distributed bitmap index.
## Install
For now, you need to manually download and link the framework in your project.### Supported Platforms
- macOS## Usage
### Quick Overview
Assuming Pilosa server is running at localhost:10101 (the default):```swift
import Pilosa// Create the default client
// You can also specify the Pilosa URI or Cluster
// to use
let client = Client()// Attempt creating index and frame references
// These calls can fail in case the naming
// conventions are not satisfied
let index = try! Index(name: "repos", columnLabel: "repo_id")
let frame = try! index.frame(name: "language")// Ensure our index and frame exists
client.ensure(index)
client.ensure(frame)// batch a set of SetBit operations
// and send to the server
client.query(
index.batch(
frame.setBit(1,1),
frame.setBit(1,2),
frame.setBit(2,3)
)
)// run a PQL query
// frame.bitmap(2) and frame[2] are equivalentlet response = client.query(
frame[2].union(frame[3]).count()
)// index.union( frame[2], frame[3] ) can also be called
// all PQL operations are supportedswitch response {
case .success(let results):
// work with results
case .failure(let error):
print(error)
}```