sqlitestore

package module
v0.0.0-...-00ca599 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 13 Imported by: 1

README

sqlitestore

GoDoc

Package sqlitestore implements the blob.Store interface using SQLite.

Documentation

Overview

Package sqlitestore implements the blob.Store interface using SQLite3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Opener

func Opener(_ context.Context, addr string) (blob.Store, error)

Opener constructs a sqlitestore from a SQLite URI, for use with the store package. To specify the table name, prefix addr with "tablename@".

If poolsize=n is set, it is used to set the pool size. If compress=v is set, it is used to enable/disable compression (default true). Other query parameters are passed to SQLite.

Types

type Options

type Options struct {
	// The name of the SQL driver to use, default "sqlite".
	Driver string

	// The number of connections to allow in the pool. If <= 0, use runtime.NumCPU.
	PoolSize int

	// The name of the table to use for blob data.  If unset, use "blobs".
	Table string

	// If true, store blobs without compression; by default blob data are
	// compressed with Snappy.
	Uncompressed bool
}

Options are options for constructing a Store. A nil *Options is ready for use and provides default values as described.

type Store

type Store struct {
	// contains filtered or unexported fields
}

A Store implements the blob.Store interface using a SQLite3 database.

func New

func New(uri string, opts *Options) (*Store, error)

New creates or opens a store at the specified database.

func (*Store) Close

func (s *Store) Close(ctx context.Context) error

Close implements blob.Closer.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

Delete implements part of blob.Store.

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) ([]byte, error)

Get implements part of blob.Store.

func (*Store) Len

func (s *Store) Len(ctx context.Context) (int64, error)

Len implements part of blob.Store.

func (*Store) List

func (s *Store) List(ctx context.Context, start string, f func(string) error) error

List implements part of blob.Store.

func (*Store) Put

func (s *Store) Put(ctx context.Context, opts blob.PutOptions) error

Put implements part of blob.Store.

Jump to

Keyboard shortcuts

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