sql

package
v0.0.0-...-7de2c07 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func CreateTables

func CreateTables(ctx context.Context, mainDB *sql.DB) error

func DirLs

func DirLs(ctx context.Context, db Transactable, root cid.Cid, metadata fielddef.SqlBytes) ([][]unixfsstore.TraversedCID, error)

func DirPath

func DirPath(ctx context.Context, db Transactable, root cid.Cid, metadata fielddef.SqlBytes, path string) ([]cid.Cid, error)

func FileAll

func FileAll(ctx context.Context, db Transactable, root cid.Cid, metadata fielddef.SqlBytes) ([][]unixfsstore.TraversedCID, error)

func FileByteRange

func FileByteRange(ctx context.Context, db Transactable, root cid.Cid, metadata fielddef.SqlBytes, min uint64, max uint64) ([][]unixfsstore.TraversedCID, error)
func InsertDirLink(ctx context.Context, db Transactable, dirLink *DirLink) error
func InsertFileLink(ctx context.Context, db Transactable, fileLink *FileLink) error

func InsertRootCID

func InsertRootCID(ctx context.Context, db Transactable, rootCID unixfsstore.RootCID) error

func RootCID

func RootCID(ctx context.Context, db Transactable, root cid.Cid) ([]unixfsstore.RootCID, error)

func RootCIDWithMetadata

func RootCIDWithMetadata(ctx context.Context, db Transactable, root cid.Cid, metadata []byte) (*unixfsstore.RootCID, error)

func SqlDB

func SqlDB(dbPath string) (*sql.DB, error)

Types

type DirLink struct {
	RootCID  cid.Cid
	Metadata fielddef.SqlBytes
	CID      cid.Cid
	Depth    uint64
	Leaf     bool
	SubPath  string
}
type FileLink struct {
	RootCID  cid.Cid
	Metadata fielddef.SqlBytes
	CID      cid.Cid
	Depth    uint64
	Leaf     bool
	ByteMin  uint64
	ByteMax  uint64
}

type SQLUnixFSStore

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

func NewSQLUnixFSStore

func NewSQLUnixFSStore(db *sql.DB) *SQLUnixFSStore

func (*SQLUnixFSStore) AddRoot

func (s *SQLUnixFSStore) AddRoot(ctx context.Context, root cid.Cid, metadata []byte, linkSystem *ipld.LinkSystem) error

func (*SQLUnixFSStore) AddRootRecursive

func (s *SQLUnixFSStore) AddRootRecursive(ctx context.Context, root cid.Cid, metadata []byte, linkSystem *ipld.LinkSystem) error

func (*SQLUnixFSStore) DirLs

func (s *SQLUnixFSStore) DirLs(ctx context.Context, root cid.Cid, metadata []byte) ([][]unixfsstore.TraversedCID, error)

func (*SQLUnixFSStore) DirPath

func (s *SQLUnixFSStore) DirPath(ctx context.Context, root cid.Cid, metadata []byte, path string) ([]cid.Cid, error)

func (*SQLUnixFSStore) FileAll

func (s *SQLUnixFSStore) FileAll(ctx context.Context, root cid.Cid, metadata []byte) ([][]unixfsstore.TraversedCID, error)

func (*SQLUnixFSStore) FileByteRange

func (s *SQLUnixFSStore) FileByteRange(ctx context.Context, root cid.Cid, metadata []byte, byteMin uint64, byteMax uint64) ([][]unixfsstore.TraversedCID, error)

func (*SQLUnixFSStore) RootCID

func (s *SQLUnixFSStore) RootCID(ctx context.Context, root cid.Cid) ([]unixfsstore.RootCID, error)

func (*SQLUnixFSStore) RootCIDWithMetadata

func (s *SQLUnixFSStore) RootCIDWithMetadata(ctx context.Context, root cid.Cid, metadata []byte) (*unixfsstore.RootCID, error)

type Scannable

type Scannable interface {
	Scan(dest ...interface{}) error
}

type Transactable

type Transactable interface {
	ExecContext(context.Context, string, ...any) (sql.Result, error)
	QueryContext(context.Context, string, ...any) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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