sqlitefile

package
v0.0.0-...-1438d1e Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Package sqlitefile provides bytes buffers backed by a temporary SQLite table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	io.Reader
	io.Writer
	io.ByteScanner
	// contains filtered or unexported fields
}

A Buffer is a variable-sized bytes buffer backed by SQLite blobs.

The bytes are broken into pages, with the first and last pages stored in memory, and intermediate pages loaded into blobs. Unlike a single SQLite blob, a Buffer can grow beyond its initial size. The blobs are allocated in a temporary table.

A Buffer is very similar to a bytes.Buffer.

func NewBuffer

func NewBuffer(conn *sqlite.Conn) (*Buffer, error)

NewBuffer creates a Buffer with 16KB pages.

func NewBufferSize

func NewBufferSize(conn *sqlite.Conn, pageSize int) (*Buffer, error)

NewBufferSize creates a Buffer with a specified page size.

func (*Buffer) Cap

func (bb *Buffer) Cap() (n int64)

func (*Buffer) Close

func (bb *Buffer) Close() error

func (*Buffer) Len

func (bb *Buffer) Len() (n int64)

func (*Buffer) Read

func (bb *Buffer) Read(p []byte) (n int, err error)

func (*Buffer) ReadByte

func (bb *Buffer) ReadByte() (byte, error)

func (*Buffer) Reset

func (bb *Buffer) Reset()

func (*Buffer) UnreadByte

func (bb *Buffer) UnreadByte() error

func (*Buffer) Write

func (bb *Buffer) Write(p []byte) (n int, err error)

func (*Buffer) WriteByte

func (bb *Buffer) WriteByte(c byte) error

WriteByte appends a byte to the buffer, growing it as needed.

func (*Buffer) WriteString

func (bb *Buffer) WriteString(p string) (n int, err error)

type File

type File struct {
	io.Reader
	io.Writer
	io.Seeker
	// contains filtered or unexported fields
}

File is a readable, writable, and seekable series of temporary SQLite blobs.

func NewFile

func NewFile(conn *sqlite.Conn) (*File, error)

func NewFileSize

func NewFileSize(conn *sqlite.Conn, initSize int) (*File, error)

func (*File) Cap

func (bb *File) Cap() (n int64)

func (*File) Close

func (bb *File) Close() error

func (*File) Len

func (bb *File) Len() (n int64)

func (*File) Read

func (bb *File) Read(p []byte) (n int, err error)

func (*File) Seek

func (bb *File) Seek(offset int64, whence int) (int64, error)

func (*File) Truncate

func (bb *File) Truncate(size int64) error

func (*File) Write

func (bb *File) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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