{"id":31733661,"url":"https://github.com/lancedb/lancedb-go","last_synced_at":"2025-10-09T08:53:23.734Z","repository":{"id":316791585,"uuid":"1063505434","full_name":"lancedb/lancedb-go","owner":"lancedb","description":"LanceDB Go SDK","archived":false,"fork":false,"pushed_at":"2025-09-26T17:25:23.000Z","size":111,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T19:20:51.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/lancedb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-24T18:06:50.000Z","updated_at":"2025-09-26T17:49:56.000Z","dependencies_parsed_at":"2025-09-27T07:32:53.106Z","dependency_job_id":null,"html_url":"https://github.com/lancedb/lancedb-go","commit_stats":null,"previous_names":["lancedb/lancedb-go"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/lancedb/lancedb-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lancedb%2Flancedb-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lancedb%2Flancedb-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lancedb%2Flancedb-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lancedb%2Flancedb-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lancedb","download_url":"https://codeload.github.com/lancedb/lancedb-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lancedb%2Flancedb-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001055,"owners_count":26082991,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-10-09T08:53:19.785Z","updated_at":"2025-10-09T08:53:23.725Z","avatar_url":"https://github.com/lancedb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LanceDB Go SDK\n\nA Go library for [LanceDB](https://github.com/lancedb/lancedb) with **pre-built native binaries**.\n\n✨ **Simple three-step installation** - download native libraries, `go get`, then set CGO variables. No build dependencies required!\n\n## Installation\n\n### Step 1: Download Native Libraries and Headers\n\nFirst, download the platform-specific native libraries and C header files:\n\n```bash\n# Download and run the artifact downloader script\ncurl -sSL https://raw.githubusercontent.com/lancedb/lancedb-go/main/scripts/download-artifacts.sh | bash\n\n# Or download a specific version\ncurl -sSL https://raw.githubusercontent.com/lancedb/lancedb-go/main/scripts/download-artifacts.sh | bash -s v1.0.0\n```\n\nAlternatively, you can download the script and run it manually:\n\n```bash\n# Download the script\ncurl -O https://raw.githubusercontent.com/lancedb/lancedb-go/main/scripts/download-artifacts.sh\nchmod +x download-artifacts.sh\n\n# Run it to get latest version\n./download-artifacts.sh\n\n# Or specify a version\n./download-artifacts.sh v1.0.0\n```\n\nThis will create the following directory structure in your project:\n\n```\nyour-project/\n├── lib/\n│   └── {platform}_{arch}/          # Platform-specific native libraries\n│       ├── liblancedb_go.a         # Static library (all platforms)\n│       ├── liblancedb_go.dylib     # Dynamic library (macOS)\n│       ├── liblancedb_go.so        # Dynamic library (Linux)\n│       └── lancedb_go.dll          # Dynamic library (Windows)\n├── include/\n│   └── lancedb.h                   # C header file (REQUIRED)\n└── your-app/\n    └── main.go\n```\n\n**Important:** Both the `lib/` directory (with platform-specific libraries) and the `include/` directory (with `lancedb.h`) are required for compilation.\n\n### Step 2: Install Go Module\n\n```bash\ngo get github.com/lancedb/lancedb-go\n```\n\n### Step 3: Set CGO Environment Variables\n\n**Important:** You must set the CGO environment variables to build projects using lancedb-go. These flags tell Go where to find the native libraries and headers.\n\n```bash\n# Get the required CGO flags for your platform\nmake platform-info\n\n# Example output will show:\n# CGO_CFLAGS:  -I/path/to/your-project/include\n# CGO_LDFLAGS: /path/to/your-project/lib/darwin_arm64/liblancedb_go.a -framework Security -framework CoreFoundation\n\n# Set the environment variables (REQUIRED):\nexport CGO_CFLAGS=\"-I$(pwd)/include\"\nexport CGO_LDFLAGS=\"$(pwd)/lib/darwin_arm64/liblancedb_go.a -framework Security -framework CoreFoundation\"\n\n# Now you can build your project:\ngo build ./cmd/myapp\n```\n\n**Note:** Replace `darwin_arm64` with your actual platform (`linux_amd64`, `windows_amd64`, etc.) as shown by `make platform-info`. These environment variables must be set every time you build a project that uses lancedb-go.\n\n### Supported Platforms\n\n- **macOS**: Intel (amd64) and Apple Silicon (arm64)\n- **Linux**: Intel/AMD (amd64) and ARM (arm64)  \n- **Windows**: Intel/AMD (amd64)\n\n## Usage\n\n### Basic Example\n\n```go\nimport (\n    \"context\"\n    \"log\"\n    \n    \"github.com/lancedb/lancedb-go/pkg/lancedb\"\n    \"github.com/apache/arrow/go/v17/arrow\"\n    \"github.com/apache/arrow/go/v17/arrow/array\"\n    \"github.com/apache/arrow/go/v17/arrow/memory\"\n)\n\n// Connect to a database\nctx := context.Background()\nconn, err := lancedb.Connect(ctx, \"data/sample-lancedb\", nil)\nif err != nil {\n    log.Fatal(err)\n}\ndefer conn.Close()\n\n// Create a table with Arrow schema\nfields := []arrow.Field{\n    {Name: \"id\", Type: arrow.PrimitiveTypes.Int32, Nullable: false},\n    {Name: \"text\", Type: arrow.BinaryTypes.String, Nullable: false},\n    {Name: \"vector\", Type: arrow.FixedSizeListOf(128, arrow.PrimitiveTypes.Float32), Nullable: false},\n}\narrowSchema := arrow.NewSchema(fields, nil)\nschema, err := lancedb.NewSchema(arrowSchema)\nif err != nil {\n    log.Fatal(err)\n}\n\ntable, err := conn.CreateTable(ctx, \"my_table\", schema)\nif err != nil {\n    log.Fatal(err)\n}\ndefer table.Close()\n\n// Insert some data\npool := memory.NewGoAllocator()\n// ... prepare your data arrays using Arrow builders ...\n\n// Perform vector search\nqueryVector := []float32{0.1, 0.3, /* ... 128 dimensions */}\nresults, err := table.VectorSearch(ctx, \"vector\", queryVector, 20)\nif err != nil {\n    log.Fatal(err)\n}\nfmt.Println(results)\n```\n\n## Examples\n\nThe [`examples/`](./examples) directory contains comprehensive examples demonstrating various LanceDB capabilities:\n\n### 📚 Available Examples\n\n1. **[Basic CRUD Operations](./examples/basic_crud/basic_crud.go)** - Fundamental database operations\n   - Database connection and table creation\n   - Schema definition with multiple data types\n   - Insert, query, update, and delete operations\n   - Error handling and resource management\n\n2. **[Vector Search](./examples/vector_search/vector_search.go)** - Vector similarity search\n   - Creating and storing vector embeddings\n   - Basic and advanced vector similarity search\n   - Performance benchmarking across different K values\n   - Vector search with metadata filtering\n\n3. **[Hybrid Search](./examples/hybrid_search/hybrid_search.go)** - Combining vector and traditional search\n   - E-commerce product catalog with vectors and metadata\n   - Vector search combined with SQL-like filters\n   - Multi-modal query patterns and recommendations\n   - Real-world search scenarios\n\n4. **[Index Management](./examples/index_management/index_management.go)** - Creating and managing indexes\n   - Vector indexes: IVF-PQ, IVF-Flat, HNSW-PQ\n   - Scalar indexes: BTree for range queries, Bitmap for categorical data\n   - Full-text search indexes\n   - Performance comparison and optimization\n\n5. **[Batch Operations](./examples/batch_operations/batch_operations.go)** - Efficient bulk data operations\n   - Different batch insertion strategies\n   - Memory-efficient processing of large datasets\n   - Concurrent batch operations with goroutines\n   - Error handling and recovery patterns\n\n6. **[Storage Configuration](./examples/storage_configuration/storage_configuration.go)** - Storage setup\n   - Local file system storage optimization\n   - AWS S3 configuration with authentication methods\n   - MinIO object storage for local development\n   - Performance comparison and optimization\n\n### 🚀 Quick Start\n\n```bash\n# Run any example\ncd examples/basic_crud\ngo run basic_crud.go\n\n# Or run from the examples directory\ngo run examples/basic_crud/basic_crud.go\n```\n\nSee the detailed [examples README](./examples/README.md) for comprehensive documentation, configuration options, and advanced usage patterns.\n\n## 🚀 Binary Distribution\n\nThis package uses **pre-built native binaries** to eliminate build dependencies:\n\n### ✅ What This Means for You\n- **No Rust installation required**\n- **No cbindgen or other build tools needed**  \n- **Simple three-step process**: download artifacts, `go get`, then set CGO variables\n- **Cross-platform** support out of the box\n- **Consistent experience** across all environments\n\n### 🔧 For Contributors \u0026 Maintainers\n- **Build locally**: `make build-native`\n- **Build all platforms**: `make build-all-platforms`\n- **See detailed guide**: [BINARY_DISTRIBUTION.md](./BINARY_DISTRIBUTION.md)\n\n### 📦 How It Works\nPre-built libraries for all supported platforms are available via GitHub releases. The download script automatically detects your platform and downloads the correct binaries to the `lib/` directory. Go's CGO system then selects the correct library for your platform during compilation.\n\n**Simple setup** - download once, then it just works! 🎉\n\n## Development\n\n### Quick Start\n\n```shell\n# Install all development dependencies\nmake install-deps\n\n# Build the project\nmake build\n\n# Run tests\nmake test\n\n# Lint code (requires golangci-lint)\nmake lint\n\n# Format code\nmake fmt\n```\n\n### Go Linting\n\nThis project uses [golangci-lint](https://golangci-lint.run/) for comprehensive Go code linting:\n\n```shell\n# Install golangci-lint (included in install-deps)\nmake install-deps\n\n# Lint Go code\nmake lint-go\n\n# Lint and auto-fix issues\nmake lint-go-fix\n```\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed development guidelines, linting configuration, and contribution instructions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flancedb%2Flancedb-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flancedb%2Flancedb-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flancedb%2Flancedb-go/lists"}