/lsembed

Simple module to embed litestream replication in your Go project

Primary LanguageGo

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()
//..