Help us shape the future of Go! Take the 2026 Go Developer Survey

datatug-core

module
v0.124.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: Apache-2.0

README

DataTug Core

Go Report Card GoDoc

DataTug Core is the foundational Go engine and domain library powering the DataTug ecosystem for database schema management, semantic modeling, recordset comparisons, and collaborative data exploration.


Architecture Summary

DataTug provides an open, modular data modeling and schema governance platform designed to bridge technical database schemas with semantic business meaning:

                       +---------------------------+
                       |    DataTug Applications   |
                       |  (CLI, Web UI, Extensions)|
                       +-------------+-------------+
                                     |
               +---------------------+---------------------+
               |                                           |
+--------------v---------------+            +--------------v---------------+
|    Semantic & Comparison     |            |      Storage & Drivers       |
|  - meaninggraph (Resolver)   |            |  - filestore (Local Git/FS)  |
|  - recordsetcompare (Diffs)  |            |  - ingitdbschema (Git DBs)   |
|  - schemer (Introspection)   |            |  - dalgostore (DALgo backend)|
|  - detective (Investigations)|            |  - dtprojcreator             |
+--------------+---------------+            +--------------+---------------+
               |                                           |
               +---------------------+---------------------+
                                     |
                       +-------------v-------------+
                       |      Core Data Types      |
                       |  - pkg/datatug            |
                       |  - pkg/dto, pkg/dtconfig  |
                       +-------------+-------------+
                                     |
                       +-------------v-------------+
                       |    Entitlement Contracts  |
                       |  - commercial/licensing   |
                       +---------------------------+
Core Architectural Pillars
  • Meaning Graph: Resolves data catalog selections, semantic models, and versioned entity relationships while preventing traversal attacks through strict fixture boundaries.
  • Recordset Comparison: High-performance row and cell-level diffing between query results and tabular snapshots, available natively and compilable to WebAssembly (cmd/recordsetcompare-wasm).
  • in-Git Schema Governance: Treat database schemas, queries, and semantic models as version-controlled code artifacts stored directly in Git repositories.
  • Extensible Storage: Neutral repository abstractions backed by filesystem (filestore) or multi-database drivers (dalgostore).
  • Clean Entitlement Boundaries: Enterprise hooks operate through cleanroom Go interfaces (commercial/licensing), keeping community code free from proprietary runtime bloat.

Module Map

Package / Directory Purpose
cmd/recordsetcompare-wasm WebAssembly module for running dataset diffs directly in browsers.
pkg/datatug Foundational domain entities: Project, Environment, DbServer, Schema, Table, Query.
pkg/meaninggraph Semantic graph resolver, catalog integrity checker, and cross-model dependency linker.
pkg/recordsetcompare Tabular comparison engine, schema diff calculations, and row change classification.
pkg/recordsetcompare/bridge Bridges comparison results into external and serialization formats.
pkg/schemer Database schema introspection, table structures, column types, and foreign key relations.
pkg/semantic Business taxonomy, semantic types, and entity classification.
pkg/detective Investigative query execution, schema consistency checks, and root-cause analysis.
pkg/detectiveai AI-assisted schema intelligence and query suggestions.
pkg/storage High-level storage contracts and repository persistence abstractions.
pkg/storage/filestore Filesystem-backed repository driver for local project trees.
pkg/storage/ingitdbschema Git-tracked database schema persistence and version management.
pkg/storage/dalgostore Generic database storage backend implemented via DALgo.
pkg/storage/dtprojcreator Project scaffolding, directory templates, and project bootstrapping.
pkg/investigation Structured data investigation plans, steps, and execution trees.
pkg/incidents Incident reports, data quality alerts, and schema regression tracking.
pkg/challenge Query challenge runners and regression test benchmarks.
pkg/dbconnection Database connection strings, parameter resolution, and connection pooling.
pkg/dto Wire format Data Transfer Objects for API and CLI interop.
commercial/licensing Enterprise entitlement contracts (EntitlementVerifier, CapacityDescriptor, CoordinatorContract).

Building and Testing

Prerequisites
  • Go 1.22+
  • Make or Bash shell
Build All Modules
go build ./...
Build WebAssembly Target

To compile the WebAssembly recordset comparator:

GOOS=js GOARCH=wasm go build -o recordsetcompare.wasm ./cmd/recordsetcompare-wasm
Run Tests

Run the complete test suite across all community packages:

go test -v ./...

Run tests with Go race detector:

go test -race ./pkg/...

Run static analysis:

go vet ./...

Licensing

DataTug is distributed under a Model A mixed licensing framework:

  • Community Open Source (Apache 2.0): All packages within pkg/, cmd/, internal/, web/, scripts/, docs/, and spec/ are licensed under the permissive Apache License, Version 2.0.
    Copyright 2020-2026 DataTug Authors and Contributors (original work Copyright 2020 sneat-team)
    
  • Commercial Extensions: Code and interfaces under commercial/ are governed by DataTug Commercial Terms.

See LICENSING.md for full details on scope boundaries and governance.


Contributing

We warmly welcome community contributions! Please read our Contributing Guide and Code of Conduct before submitting pull requests.

Security vulnerabilities should be reported following our Security Policy.

Directories

Path Synopsis
cmd
commercial
internal
jsonstrict
Package jsonstrict provides target-aware JSON key validation shared by transport and persisted event decoders.
Package jsonstrict provides target-aware JSON key validation shared by transport and persisted event decoders.
plainfs
Package plainfs writes, removes and creates folders inside a project folder only through plain files and plain folders.
Package plainfs writes, removes and creates folders inside a project folder only through plain files and plain folders.
pkg
apicontract
Package apicontract holds the Go types for every shared JSON type and envelope in the core-investigation-loop Feature's normative transport appendix (spec/features/core-investigation-loop/api-contract.md, hub datatug/datatug), with the exact json:"..." field names that document declares - the schema authority datatug-cli (server) and datatug-apps (client) consume, per Phase 1 corrective Task 12.
Package apicontract holds the Go types for every shared JSON type and envelope in the core-investigation-loop Feature's normative transport appendix (spec/features/core-investigation-loop/api-contract.md, hub datatug/datatug), with the exact json:"..." field names that document declares - the schema authority datatug-cli (server) and datatug-apps (client) consume, per Phase 1 corrective Task 12.
apicontract/fixtures
Package fixtures holds the frozen JSON fixtures for pkg/apicontract's normative transport types (spec/features/core-investigation-loop/ api-contract.md, hub datatug/datatug) - one file per envelope/error case listed in the appendix's "Acceptance and migration" section.
Package fixtures holds the frozen JSON fixtures for pkg/apicontract's normative transport types (spec/features/core-investigation-loop/ api-contract.md, hub datatug/datatug) - one file per envelope/error case listed in the appendix's "Acceptance and migration" section.
challenge
Package challenge owns the immutable, schema-versioned definition of a guided SQL challenge and its deterministic grading primitives.
Package challenge owns the immutable, schema-versioned definition of a guided SQL challenge and its deterministic grading primitives.
challengetimer
Package challengetimer measures active solving time, excluding pauses.
Package challengetimer measures active solving time, excluding pauses.
datatug
Package datatug holds the DataTug project model: entities, queries, environments, boards and their validation rules.
Package datatug holds the DataTug project model: entities, queries, environments, boards and their validation rules.
detective
Package detective owns shared Checks, Validators and investigation Cases.
Package detective owns shared Checks, Validators and investigation Cases.
detectiveai
Package detectiveai contains provider-neutral, reviewable Detective AI proposals.
Package detectiveai contains provider-neutral, reviewable Detective AI proposals.
detectiveknowledge
Package detectiveknowledge owns the private, reviewable knowledge proposal contract shared by local and hosted Detective stores.
Package detectiveknowledge owns the private, reviewable knowledge proposal contract shared by local and hosted Detective stores.
dto
incidents
Package incidents defines Incidentius's store-independent incident model and deterministic event projection.
Package incidents defines Incidentius's store-independent incident model and deterministic event projection.
investigation
Package investigation owns the shared Investigation Context value model.
Package investigation owns the shared Investigation Context value model.
meaninggraph
Package meaninggraph resolves exact retained DataModel source revisions.
Package meaninggraph resolves exact retained DataModel source revisions.
recordsetcompare
Package recordsetcompare provides a deterministic, pure comparison of two policy-filtered recordsets.
Package recordsetcompare provides a deterministic, pure comparison of two policy-filtered recordsets.
recordsetcompare/bridge
Package bridge implements the bounded, receipt-free JSON ABI used by the linked WebAssembly entry point.
Package bridge implements the bounded, receipt-free JSON ABI used by the linked WebAssembly entry point.
semantic
Package semantic resolves physical columns (a source + collection + set of scanned columns) to the entity fields a project's model says they mean.
Package semantic resolves physical columns (a source + collection + set of scanned columns) to the entity fields a project's model says they mean.
sessioncontext
Package sessioncontext owns private, durable session context and immutable input pins.
Package sessioncontext owns private, durable session context and immutable input pins.
storage
Package dtprojcreator is a generated GoMock package.
Package dtprojcreator is a generated GoMock package.
storage/dalgostore
Package dalgostore implements storage.Store and datatug.ProjectStore over a caller-supplied dal.DB (dalgo-project-store plan): Store (store.go) creates, lists, opens and deletes projects in one store, and ProjectStore (this file) addresses one project in it.
Package dalgostore implements storage.Store and datatug.ProjectStore over a caller-supplied dal.DB (dalgo-project-store plan): Store (store.go) creates, lists, opens and deletes projects in one store, and ProjectStore (this file) addresses one project in it.
storage/filestore
Package filestore's query pair transaction protocol (this file) persists a query's JSON metadata and its body sidecar as one recoverable logical transaction, under the query store lock (query_lock.go):
Package filestore's query pair transaction protocol (this file) persists a query's JSON metadata and its body sidecar as one recoverable logical transaction, under the query store lock (query_lock.go):
storage/ingitdbschema
Package ingitdbschema ships DataTug's inGitDB project-store schema as static files and copies them into a store directory when a project store is initialised.
Package ingitdbschema ships DataTug's inGitDB project-store schema as static files and copies them into a store directory when a project store is initialised.
walkthrough
Package walkthrough owns the pure walkthrough contracts: the ordinary `datatug-walkthrough/1` declaration, the opt-in `datatug-walkthrough/2` training declaration additions, immutable asset/package references and source pins, the public story registry shape and the external checkpoint envelope with its pure match decisions.
Package walkthrough owns the pure walkthrough contracts: the ordinary `datatug-walkthrough/1` declaration, the opt-in `datatug-walkthrough/2` training declaration additions, immutable asset/package references and source pins, the public story registry shape and the external checkpoint envelope with its pure match decisions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL