storage

package
v0.0.0-...-f2ba6e3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLite

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

SQLite defines a generic structure for persisting data to an sqlite3 database

func (*SQLite) Close

func (s *SQLite) Close()

Close cleans up and closes the database

func (*SQLite) GetQueue

func (s *SQLite) GetQueue() []string

GetQueue loads any unvisited links from the database

func (*SQLite) Init

func (s *SQLite) Init() ([]string, error)

Init initializes the database Include your database creation statement as well as your insert statement

func (*SQLite) Write

func (s *SQLite) Write(obj data.Parser) error

Write inserts a single row into the database table

type Writer

type Writer interface {
	// Init performs any initialization before the data can be written. This is always be called first
	// If the storage has any links that have not been visted, add those back to the queue
	Init() ([]string, error)

	// Write writes a single data.Parser object
	Write(obj data.Parser) error

	GetQueue() []string

	// Close performs and shutdown tasks. This must always be called last
	Close()
}

Writer is an interface to save data to a specific location Provides a flexibile interface to save in variable formats

Jump to

Keyboard shortcuts

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