{"id":27380124,"url":"https://github.com/louis77/valentina-go","last_synced_at":"2026-04-29T01:32:39.766Z","repository":{"id":287206079,"uuid":"963906141","full_name":"louis77/valentina-go","owner":"louis77","description":"This is a non-offical Go driver for Valentina DB server based on Valentina REST API.","archived":false,"fork":false,"pushed_at":"2025-04-11T23:54:06.000Z","size":64,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T16:25:51.496Z","etag":null,"topics":["database","go","sql","valentina","valentina-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/louis77.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-10T11:49:11.000Z","updated_at":"2025-04-11T23:54:09.000Z","dependencies_parsed_at":"2025-04-13T14:19:11.202Z","dependency_job_id":null,"html_url":"https://github.com/louis77/valentina-go","commit_stats":null,"previous_names":["louis77/valentina-go"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/louis77/valentina-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louis77%2Fvalentina-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louis77%2Fvalentina-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louis77%2Fvalentina-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louis77%2Fvalentina-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/louis77","download_url":"https://codeload.github.com/louis77/valentina-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louis77%2Fvalentina-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32407164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"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":["database","go","sql","valentina","valentina-server"],"created_at":"2025-04-13T14:19:05.978Z","updated_at":"2026-04-29T01:32:39.751Z","avatar_url":"https://github.com/louis77.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Valentina Go Driver\n\n[![Go](https://github.com/louis77/valentina-go/actions/workflows/go.yml/badge.svg)](https://github.com/louis77/valentina-go/actions/workflows/go.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/louis77/valentina-go)](https://goreportcard.com/report/github.com/louis77/valentina-go)\n\nThis is a non-offical Go driver for Valentina DB based on Valentina REST API. It implements the [database/sql](https://pkg.go.dev/database/sql) package.\n\nTested with [Valentina DB](https://valentina-db.com) 15.1.2. It should work with versions \u003e= v.15.0.1, which introduced the REST API.\n\nWhy use Valentina's REST API and not the native binary protocol? The later is proprietary, closed-source and would require CGo and linking with the official Valentina C SDK. The maintainer decided to use the dependency-free REST API instead.\n\n## Installation\n\n```bash\ngo get github.com/louis77/valentina-go\n```\n\n## Usage\n\nThis driver is using Valentina REST API. You need to activate it in Valentina server by setting an appropriate port in the [`vserver.ini`](https://valentina-db.com/docs/dokuwiki/v15/doku.php?id=valentina:products:vserver:manual:ini_file) file:\n\n```ini\n[REST]\nPORT_REST = 19998\nPORT_REST_SSL=19999\n```\n\nAfter that, you can use the driver like any other `sql/database` driver, see [Limitations](#limitations) below.\n\n```go\npackage main\n\nimport (\n\t\"database/sql\"\n\n\t_ \"github.com/louis77/valentina-go/vdriver\"\n)\n\nfunc main() {\n\t// Valentina DB\n\tdb, err := sql.Open(\"valentina\", \"http://sa:sa@localhost:19998\")\n\t// Valentina SQLite\n\t// db, err := sql.Open(\"vsqlite\", \"http://sa:sa@localhost:19998\")\n\t// Valentina SQLite\n\t// db, err := sql.Open(\"vduckdb\", \"http://sa:sa@localhost:19998\")\n\n\trow := db.QueryRow(\"SELECT now(), :1 as a_number\", 69)\n\n\tvar now string\n\tvar anumber int\n\terr = row.Scan(\u0026now, \u0026anumber)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to scan row: %v\", err)\n\t}\n\n\t// Use data\n}\n```\n\nYou can also use the `vdriver.Config` struct to configure the connection:\n\n```go\ncfg := vdriver.Config{\n\tDB:       \"testdb\",\n\tUser:     \"sa\",\n\tPassword: \"sa\",\n\tHost:     \"localhost\",\n\tPort:     19998,\n\tUseSSL:   false,\n}\n\ndb, err := sql.Open(\"valentina\", cfg.FormatDSN())\n```\n\nOr use `sql.OpenDB()`:\n\n```go\n\tconnector := vdriver.NewConnector(vdriver.VendorValentina, vdriver.Config{\n\t\tDB:       \"\",\n\t\tUser:     \"sa\",\n\t\tPassword: \"sa\",\n\t\tHost:     \"localhost\",\n\t\tPort:     19998,\n\t\tUseSSL:   false,\n\t})\n\n\tdb := sql.OpenDB(connector)\n```\n\nValentina Server supports three different engines. Use the `driverName` to indicate which engine you want use:\n\n- Valentina DB: `valentina`\n- Valentina SQLite: `vsqlite`\n- Valentina DuckDB: `vduckdb`\n\n### Use the CLI\n\nThis package contains a small CLI tool to connect to Valentina DB and execute SQL queries. It can be used as follows:\n\n```bash\n$ go install ./cmd/vsql\n\n# Show help\n$ vsql -h\n```\n\nYou can also use the `.verbose` command to see the results in a tabular format.\n\n### Connection Parameters\n\nThe driver accepts the following parameters:\n\n- `vendor`: the vendor name (default: `Valentina`, others: `SQLite`, `DuckDB`).\n\n## Special Types\n\n### DateTime\n\nThe `vsql` package provides a special type `Time` that can be used to scan Valentina time values. It implements the `Scanner` and `Valuer`. The driver sets the appropriate `DateFormat` and `DateSeparator` properties in the database for each new connection.\n\n```go\nrow := db.QueryRow(\"SELECT now()\")\nvar now vsql.Time\nerr = row.Scan(\u0026now)\n```\n\n### Arrays\n\nValentina supports the `ARRAY` type which is a fixed-size array of a specific underlying type. You can scan an array by using `[]any` as the destination type.\n\n## Notes about Valentina SQL\n\nPlaceholders for parameters are prefixed with a colon (`:`) and a number, starting from 1. This way, the same parameter can be used multiple times in the query:\n\n```sql\nSELECT :1 + :2\n```\n\nAlternatively, you can use MySQL-style `?` placeholders:\n\n```sql\nSELECT ? + ?\n```\n\nThe driver will automatically convert the parameters to the right type.\n\n## Limitations\n\n- Valentina does not support transactions\n- Valentina does not support implicit LastInsertId() when using Exec(). You need to fetch it with `SELECT Last_RecID()`\n- Prepared statements work, the REST API doesn't supporting caching statements, so each execution of a prepared statement will send the full query text to the server\n- Expired REST sessions are automatically refreshed, queries will not fail because of an expired session\n- If your license allows only a limited number of REST connections, don't forget to set the maximum open connections, i.e.: `db.SetMaxOpenConns(3)`\n- \"Notifications\" are not supported through the REST API\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the BSD 3-Clause License - see the [LICENSE](LICENSE) file for details.  \"Valentina\", \"Valentina Server\", \"Valentina Studio\" are trademarks of [Paradigma Software, Inc](https://www.valentina-db.com). This project is a voluntary effort and neither paid for nor affiliated with Paradigma Software.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouis77%2Fvalentina-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouis77%2Fvalentina-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouis77%2Fvalentina-go/lists"}