{"id":38066537,"url":"https://github.com/goptics/sqliteq","last_synced_at":"2026-01-16T20:35:18.942Z","repository":{"id":291781111,"uuid":"978066744","full_name":"goptics/sqliteq","owner":"goptics","description":"A sqlite based queue written in go","archived":false,"fork":false,"pushed_at":"2025-06-28T04:32:32.000Z","size":57,"stargazers_count":34,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-28T05:22:34.783Z","etag":null,"topics":["persistent-storage","queue","sql","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goptics.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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}},"created_at":"2025-05-05T12:22:24.000Z","updated_at":"2025-06-28T04:31:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"923a66ce-a3e2-413d-8490-7edbcb5532d7","html_url":"https://github.com/goptics/sqliteq","commit_stats":null,"previous_names":["goptics/sqliteq"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/goptics/sqliteq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goptics%2Fsqliteq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goptics%2Fsqliteq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goptics%2Fsqliteq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goptics%2Fsqliteq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goptics","download_url":"https://codeload.github.com/goptics/sqliteq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goptics%2Fsqliteq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28482267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["persistent-storage","queue","sql","sqlite"],"created_at":"2026-01-16T20:35:18.317Z","updated_at":"2026-01-16T20:35:18.923Z","avatar_url":"https://github.com/goptics.png","language":"Go","readme":"# SQLiteQ: A SQLite-Based Persistent Queue for Go\n\n[![Go Reference](https://img.shields.io/badge/go-pkg-00ADD8.svg?logo=go)](https://pkg.go.dev/github.com/goptics/sqliteq)\n[![Go Report Card](https://goreportcard.com/badge/github.com/goptics/sqliteq)](https://goreportcard.com/report/github.com/goptics/sqliteq)\n[![Go Version](https://img.shields.io/badge/Go-1.24+-00ADD8?style=flat-square\u0026logo=go)](https://golang.org/doc/devel/release.html)\n[![CI](https://github.com/goptics/sqliteq/actions/workflows/sqliteq.yml/badge.svg)](https://github.com/goptics/sqliteq/actions/workflows/go.yml)\n[![codecov](https://codecov.io/gh/goptics/sqliteq/branch/main/graph/badge.svg)](https://codecov.io/gh/goptics/sqliteq)\n\nSQLiteQ is a persistent queue implementation in Go using SQLite as the storage backend. It provides efficient enqueue and dequeue operations and maintains persistence across application restarts.\n\n## Features\n\n- Efficient enqueue and dequeue operations\n- Persistence via SQLite storage\n- Support for acknowledgment-based processing\n- Simple and clean API following the Queue interface\n- Built as a persistence adapter for [varmq](https://github.com/goptics/varmq)\n\n## Installation\n\n```bash\ngo get github.com/goptics/sqliteq\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n\n    \"github.com/goptics/sqliteq\"\n)\n\nfunc main() {\n    // Create a new SQLite queues manager\n    // The parameter is the path to the SQLite database file\n    queuesManager := sqliteq.New(\"queue.db\")\n    defer queuesManager.Close()\n\n    // Create a new queue\n    // The parameter is the name of the table to use for the queue\n    queue, err := queuesManager.NewQueue(\"my_queue\")\n    if err != nil {\n        log.Fatalf(\"Failed to create queue: %v\", err)\n    }\n\n    // You can also create a queue with custom options\n    // For example, to keep acknowledged items in the database:\n    queueWithOptions, err := queuesManager.NewQueue(\"my_other_queue\",\n        sqliteq.WithRemoveOnComplete(false)) // Set to false to keep acknowledged items\n    if err != nil {\n        log.Fatalf(\"Failed to create queue: %v\", err)\n    }\n\n    // Create a priority queue\n    priorityQueue, err := queuesManager.NewPriorityQueue(\"my_priority_queue\")\n    if err != nil {\n        log.Fatalf(\"Failed to create priority queue: %v\", err)\n    }\n\n    // Enqueue items\n    queue.Enqueue([]byte(\"item 1\"))\n    queue.Enqueue([]byte(\"item 2\"))\n\n    // Get queue length\n    fmt.Printf(\"Queue length: %d\\n\", queue.Len())\n\n    // Get all pending items\n    items := queue.Values()\n    fmt.Printf(\"All items: %v\\n\", items)\n\n    // Simple dequeue\n    item, success := queue.Dequeue()\n    if success {\n        fmt.Printf(\"Dequeued item: %v\\n\", string(item.([]byte)))\n    }\n\n    // Dequeue with acknowledgment\n    item, success, ackID := queue.DequeueWithAckId()\n    if success {\n        fmt.Printf(\"Dequeued item: %v with ack ID: %s\\n\", string(item.([]byte)), ackID)\n\n        // Process the item...\n\n        // Acknowledge the item after processing\n        acknowledged := queue.Acknowledge(ackID)\n        fmt.Printf(\"Item acknowledged: %v\\n\", acknowledged)\n\n        // Note: By default, acknowledged items are removed from the database\n        // With WithRemoveOnComplete(false), they would be marked as completed instead\n    }\n\n    // Purge the queue\n    queue.Purge()\n}\n```\n\n## How It Works\n\nSQLiteQ uses a SQLite database to store queue items with the following schema:\n\n- `id`: Unique identifier for each item (autoincrement primary key)\n- `data`: The serialized item data (stored as a JSON blob)\n- `status`: The status of the item (\"pending\", \"processing\", or \"completed\")\n- `ack_id`: A unique ID for acknowledging processed items\n- `created_at`: When the item was added to the queue\n- `updated_at`: When the item was last updated\n\n\u003e NOTE: By default, when an item is acknowledged, it is removed from the database. However, you can configure the queue to keep acknowledged items by using the `WithRemoveOnComplete(false)` option when creating the queue. In this case, acknowledged items will be marked as \"completed\" but will remain in the database.\n\n## Performance Considerations\n\n- The queue is optimized for efficient enqueue and dequeue operations that scale well with queue size\n- Operations leverage SQLite's indexing for logarithmic time complexity rather than true constant-time\n- SQLite's WAL (Write-Ahead Logging) mode is enabled for better concurrent access\n- Proper indexing is set up on the status and creation time columns for efficient querying\n\n## 👤 Author\n\n- GitHub: [@fahimfaisaal](https://github.com/fahimfaisaal)\n- LinkedIn: [in/fahimfaisaal](https://www.linkedin.com/in/fahimfaisaal/)\n- Twitter: [@FahimFaisaal](https://twitter.com/FahimFaisaal)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoptics%2Fsqliteq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoptics%2Fsqliteq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoptics%2Fsqliteq/lists"}