Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 797 Bytes

README.md

File metadata and controls

35 lines (26 loc) · 797 Bytes

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