Skip to content

Infranite/go-dblog

Repository files navigation

go-dblog

CI Go Version Go Reference Go Report Card License

go-dblog is a multi-module Go toolkit for parsing database change logs. The root module defines shared event, registry, checkpoint, filtering, and safe flashback/recovery contracts; each backend keeps product-specific parsing, live reading, typed events, and extension hooks in its own module.

中文

Product Index

Install only the backend you use.

Product Module README Features Examples
Common API github.com/Infranite/go-dblog This README Roadmap scope Minimal example below
MySQL family github.com/Infranite/go-dblog/mysql English / 中文 English / 中文 English / 中文
PostgreSQL family github.com/Infranite/go-dblog/postgres English / 中文 English / 中文 English / 中文
MongoDB family github.com/Infranite/go-dblog/mongo English / 中文 English / 中文 English / 中文
Redis family github.com/Infranite/go-dblog/redis English / 中文 English / 中文 English / 中文

Core Features

  • Backend-neutral dblog.Event shape for mixed database log streams.
  • Explicit backend registration through dblog.Registry.
  • Streaming decoders built on Go iterator APIs.
  • Shared source metadata, position, checkpoint resume, filtering, and safe flashback/recovery helpers.
  • Backend-native typed events for database-specific fields.
  • Plugin hooks inside backend decoder packages for compatible dialects and product-specific records.
  • Separate Go modules so callers do not install unused database dependencies.

Install

The current public tag set is v0.3.0.

go get github.com/Infranite/go-dblog@v0.3.0
go get github.com/Infranite/go-dblog/mysql@v0.3.0
go get github.com/Infranite/go-dblog/postgres@v0.3.0
go get github.com/Infranite/go-dblog/mongo@v0.3.0
go get github.com/Infranite/go-dblog/redis@v0.3.0

Minimal Example

package main

import (
	"fmt"
	"strings"

	"github.com/Infranite/go-dblog"
	"github.com/Infranite/go-dblog/redis"
)

func main() {
	var registry dblog.Registry
	if err := redis.Register(&registry); err != nil {
		panic(err)
	}

	decoder, err := registry.Open(redis.Driver,
		dblog.WithReader(strings.NewReader("*2\r\n$4\r\nINCR\r\n$7\r\ncounter\r\n")),
	)
	if err != nil {
		panic(err)
	}
	defer decoder.Close()

	for event, err := range decoder.Events() {
		if err != nil {
			panic(err)
		}
		fmt.Println(event.Kind(), dblog.PositionOf(event).Value)
	}
}

Use the common API for multi-source routing, shared filtering, CDC pipelines, backend registration, and recovery tasks. Use backend-native APIs when you need database-specific event fields.

Project Docs

Topic English 中文
Project overview This README doc/README.zh-CN.md
Recovery cookbook doc/RECOVERY.md doc/RECOVERY.zh-CN.md
Roadmap and product scope doc/ROADMAP.md doc/ROADMAP.zh-CN.md
Development and contribution flow doc/DEVELOPMENT.md doc/DEVELOPMENT.zh-CN.md
Security policy doc/SECURITY.md doc/SECURITY.zh-CN.md

GitHub Releases and git tags are the public release record. Git history is the detailed change log; this repository does not maintain separate release notes or changelog files.

License

Apache License 2.0. See LICENSE.

About

High-performance database change log parsing toolkit for Go

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors