jinjie / lsembed

Simple module to embed litestream replication in your Go project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Litestream Embeded

Simple Go module to embed litestream replication in your Go project.

Adapted from example

Get

go get github.com/jinjie/lsembed

Example

// ...
replica := litestream.NewReplica(
    litestream.NewDB(app.DataDir()+"/data.db"),
    "s3",
)

replica.Client = &s3.ReplicaClient{
    AccessKeyID:     "ACCESSKEY",
    SecretAccessKey: "SECRETKEY",
    Bucket:          "litestream-test-bucket",
    Region:          "ap-southeast-1",
    Path:            "path",
}

lsdb, err := lsembed.Replicate(replica)
if err != nil {
    log.Fatal().Err(err).Msg("failed to replicate")
}

defer lsdb.Close()
//..

About

Simple module to embed litestream replication in your Go project


Languages

Language:Go 100.0%