Skip to content

docs: add LICENSE, contributing guides and a full README rewrite - #10

Open
ack3rs wants to merge 5 commits into
mainfrom
docs/open-source-essentials
Open

ack3rs wants to merge 5 commits into
mainfrom
docs/open-source-essentials

Conversation

@ack3rs

@ack3rs ack3rs commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Adds the open-source essentials GoStructDB was missing and rewrites the docs so a newcomer can install it and get something working in a few minutes. Docs/metadata only: no Go code changed.

What's added

  • LICENSE: MIT, Copyright (c) 2026 SpaceTent (new; the repo had no licence, which legally means "all rights reserved")
  • README.md rewritten: badges (Go Reference, CI, Go Report Card, release, licence), why/features, requirements (incl. cgo), install, a verified, copy-paste quick start with real output, connecting, a full struct tag reference and supported types table, usage for every public API, configuration variables, trade-offs/caveats, project layout, status, contributing, licence. Your original "why" text is kept, lightly edited.
  • docs/getting-started.md: step-by-step SQLite walkthrough, then the changes for MySQL
  • docs/architecture.md: how the package works, with a mermaid diagram drawn from the code
  • examples/README.md: what each example shows and how to actually run them (they need the Test table to exist first)
  • CONTRIBUTING.md: dev setup, tests (no DB needed), formatting, make targets, branch/commit/PR conventions, release process
  • CODE_OF_CONDUCT.md: Contributor Covenant 2.1
  • SECURITY.md: private reporting via GitHub advisories, email fallback, scope notes
  • CHANGELOG.md: Keep a Changelog format, seeded from the tags and GitHub releases v0.0.7 → v0.0.14
  • .github/ISSUE_TEMPLATE/ (bug + feature forms, security contact link) and PULL_REQUEST_TEMPLATE.md

Fixes to the old README (it didn't match the code)

  • gsdb.Save(entry, 0) → Save is a method: gsdb.DB.Save(entry, entry.Id)
  • ColumnWarnings = true was described as turning warnings off; it turns them on
  • GetCounter("test) had a missing quote
  • Empty ### ShowSQL section, now documented
  • Undocumented: readdefault=null, omit=yes, MaxOpenConns/MaxIdleConns, Record/Field converters, RecordInsert/RecordUpdate, NewSQLite3

What I verified (go1.26.0, linux/amd64)

Check Result
go build ./... ✅
go vet ./... ✅ clean
go test ./... ✅ ok github.com/SpaceTent/GoStructDB/gsdb
README quick start, in a fresh module against the published v0.0.14 ✅ runs; the output in the README is the real output
Every other README snippet (Execute, Insert/Update, Save, QueryStruct, QuerySingleStruct with no rows, Records/Fields, counters, RecordInsert, ShowSQL, ColumnWarnings) ✅ compiled and run against SQLite
CGO_ENABLED=0 behaviour ✅ builds, then SQLite fails at runtime with the stub error (documented)
examples/ procedure in examples/README.md (sqlite3 test.db "CREATE TABLE…" then DSN=test.db go run main.go) ✅ runs; also confirmed the "run twice" fallback
Mermaid diagram ✅ renders with mermaid-cli

Not verified: the MySQL steps (no MySQL server available here). The DSN format, lazy connect/ping and pool behaviour are documented from the code, not a live run.

Needs your decision

  • Licence: I picked MIT to match k8sec. Change it if you want something else (Apache-2.0 etc.) before merging.
  • Contact email: SECURITY.md and CODE_OF_CONDUCT.md use mark@ackroyd.net (already public in the commit history). Swap in a different address if you prefer.
  • Turn on private vulnerability reporting: it's currently off for this repo. Settings → Code security → Private vulnerability reporting → Enable. SECURITY.md and the issue template link to it.

Things I noticed in the code (not changed in this PR)

These are documented honestly in the README where they affect users; worth separate issues/PRs:

  1. InsertMany generates invalid SQL for >1 row. Rows are joined with \n but no comma: INSERT INTO t(n) VALUES (X'61')\n(X'62');. The README tells people to use Insert in a loop for now.
  2. getConnection() can deadlock: when the DSN is empty or all 3 connection attempts fail, it returns without DB.Lock.Unlock(), so the next call hangs forever.
  3. String primary keys in Update are written unquoted in the WHERE clause (WHERE id=abc), which breaks and isn't escaped. RecordUpdate's value parameter is concatenated raw too.
  4. []byte fields work for reads but Insert/Update hit the default branch and panic on value.(string).
  5. QueryStruct logs every blob field at INFO (Setting Blob field ...), which is noisy.
  6. The Database struct has MaxDatabaseOpenConnections, MaxDatabaseIdleConnections and DatabaseIdleTimeout fields that nothing reads (the package vars are used instead).
  7. CI uses actions/setup-go@v4 with no go-version. It works via toolchain download, but go-version-file: go.mod on setup-go@v5 would be more explicit. Just a suggestion; I didn't touch CI.

Screenshots

GSDB is a library with no UI, so there are no screenshots. The README uses real program output in code blocks instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant