{"id":25337664,"url":"https://github.com/jshinonome/geek","last_synced_at":"2025-10-29T09:30:54.111Z","repository":{"id":57662104,"uuid":"433015388","full_name":"jshinonome/geek","owner":"jshinonome","description":"golang interface for kdb+/q","archived":false,"fork":false,"pushed_at":"2023-08-06T00:37:34.000Z","size":36,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-08-19T09:02:25.956Z","etag":null,"topics":["go","golang","kdb"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jshinonome.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-29T11:27:03.000Z","updated_at":"2023-02-23T16:27:33.000Z","dependencies_parsed_at":"2022-09-12T23:21:29.344Z","dependency_job_id":null,"html_url":"https://github.com/jshinonome/geek","commit_stats":null,"previous_names":[],"tags_count":10,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshinonome%2Fgeek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshinonome%2Fgeek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshinonome%2Fgeek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshinonome%2Fgeek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jshinonome","download_url":"https://codeload.github.com/jshinonome/geek/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238798653,"owners_count":19532276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","kdb"],"created_at":"2025-02-14T06:56:12.780Z","updated_at":"2025-10-29T09:30:53.497Z","avatar_url":"https://github.com/jshinonome.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geek\n\nGeek is a kdb+/q interface for Go (Golang). It comes with a kdb+/q load balancer ConnPool, which uses a buffered channel to handle the connections pool.\n\n-   ConnPool.Handle\n    -   doesn't serialize or deserialize IPC message.\n    -   before passing on IPC messages, define .geek.user and .geek.ip on the q process\n-   ConnPool.Sync\n    -   need a known go type pointer as an parameter\n\n## Contents\n\n-   [Installation](#installation)\n-   [Quick Start](#quick-start)\n-   [Data Types](#data-types)\n\n## Installation\n\n1. Install Geek\n\n```sh\ngo get -u github.com/jshinonome/geek\n```\n\n2. Import it in your code\n\n```go\nimport \"github.com/jshinonome/geek\"\n```\n\n## Quick Start\n\n### Load balancer\n\n1. Create an example.go file as below\n\n```go\npackage main\n\nimport \"github.com/jshinonome/geek\"\n\nfunc main() {\n\t// connect to a q process @ 1800\n\tq1 := geek.QProcess{Port: 1800}\n\tq1.Dial()\n\t// connect to a q process @ 1801\n\tq2 := geek.QProcess{Port: 1801}\n\tq2.Dial()\n\tqConnPool := geek.NewConnPool()\n\tqConnPool.Put(\u0026q1)\n\tqConnPool.Put(\u0026q2)\n\tqConnPool.Serving()\n\n\tqEngine := geek.DefaultEngine(qConnPool)\n\tqEngine.Run() // listen and server on :8101\n}\n```\n\n2. Start two q processes\n\n```sh\nq -p 1800\n```\n\n```sh\nq -p 1801\n```\n\n3. Run the q Engine\n\n```sh\ngo run example.go\n```\n\n4. Start a new q process and run queries(geek.Engine doesn't keep client connection, so don't try to open a handle)\n\n```q\n`::8101 (\"system\";\"p\") //1800\n`::8101 (\"system\";\"p\") //1801\n```\n\n### Interface with q process\n\n1. Create an example.go file as below\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/jshinonome/geek\"\n)\n\nfunc main() {\n\t// connect to a q process @ 1800\n\tq := geek.QProcess{Port: 1800}\n\tq.Dial()\n\tsym := \"a\"\n\tf := struct {\n\t\tApi string\n\t\tSym string\n\t}{\n\t\t\"getTrade\", sym,\n\t}\n\tr := make([]trade, 0)\n\terr := q.Sync(\u0026r, f)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tfor _, t := range r {\n\t\tfmt.Printf(\"%+v\\n\", t)\n\t}\n}\n\ntype trade struct {\n\tTime  time.Time `k:\"time\"`\n\tSym   string    `k:\"sym\"`\n\tPrice float64   `k:\"price\"`\n\tQty   int64     `k:\"qty\"`\n}\n```\n\n2. Start a q process\n\n```q\nq -p 1800\ntrade:([]time:\"p\"$.z.D-til 10;sym:10?`a`b;price:10?10.0;qty:10?10);\ngetTrade:{select from trade where sym=x};\n.z.pg:{[x]0N!(`zpg;x);value x};\n```\n\n3. Run go program\n\n```sh\ngo run example.go\n```\n\n## Data Types\n\n### Basic Types\n\nIntend to support only these 6 types\n\n| kdb       | go        |\n| --------- | --------- |\n| long      | int64     |\n| float     | float64   |\n| char      | byte      |\n| symbol    | string    |\n| timestamp | time.Time |\n| boolean   | bool      |\n\n### Other Types\n\ngo struct without k tags -\u003e k mixed list\n\n```go\nstruct {\n\tFunc   string\n\tParam1 string\n\tParam2 string\n}\n```\n\ngo map -\u003e k dictionary\n\n```go\nmap[string]bool\n```\n\ngo struct with k tags(keys' name) -\u003e k dictionary\n\n```go\nstruct {\n\tKey1 string    `k:\"sym\"`\n\tKey2 time.Time `k:\"time\"`\n\tKey3 float64   `k:\"qty\"`\n}\n```\n\ngo list of a struct with k tags(column names) -\u003e k table\n\n```go\n[]struct {\n\tSym  string    `k:\"sym\"`\n\tTime time.Time `k:\"time\"`\n\tQty  float64   `k:\"qty\"`\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjshinonome%2Fgeek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjshinonome%2Fgeek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjshinonome%2Fgeek/lists"}