Documentation
¶
Overview ¶
Package datasource contains all the supported data sources in Kite. A datasource refers to any component that provides access to data — such as databases or message queues. Kite comes with built-in support for SQL and Redis data sources out of the box.
Index ¶
Constants ¶
const ( StatusUp = "UP" StatusDown = "DOWN" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Datasource ¶
type ErrorDB ¶
ErrorDB represents an error specific to database operations.
func (ErrorDB) StatusCode ¶
type ErrorRecordNotFound ¶
type ErrorRecordNotFound ErrorDB
ErrorRecordNotFound represents the scenario where no records are found in the DB for the given ID.
func (ErrorRecordNotFound) StatusCode ¶
func (ErrorRecordNotFound) StatusCode() int
StatusCode implementation on the ErrorRecordNotFound is an aberration since the errors in datasource package should not have anything to do with HTTP status codes.
type File ¶
type File interface {
io.Closer
io.Reader
io.ReaderAt
io.Seeker
io.Writer
io.WriterAt
ReadAll() (RowReader, error)
}
File represents a file in the filesystem.
type FileSystem ¶
type FileSystem interface {
// Create creates a file in the filesystem, returning the file and an
// error, if any happens.
Create(name string) (File, error)
// Mkdir creates a directory in the filesystem, return an error if any
// happens.
Mkdir(name string, perm os.FileMode) error
// MkdirAll creates a directory path and all parents that does not exist
// yet.
MkdirAll(path string, perm os.FileMode) error
// Open opens a file, returning it or an error, if any happens.
Open(name string) (File, error)
// OpenFile opens a file using the given flags and the given mode.
OpenFile(name string, flag int, perm os.FileMode) (File, error)
// Remove removes a file identified by name, returning an error, if any
// happens.
Remove(name string) error
// RemoveAll removes a directory path and any children it contains. It
// does not fail if the path does not exist (return nil).
RemoveAll(path string) error
// Rename renames a file.
Rename(oldname, newname string) error
}
FileSystem : Any simulated or real filesystem should implement this interface.
type FileSystemProvider ¶
type FileSystemProvider interface {
FileSystem
// UseLogger sets the logger for the FileSystem client.
UseLogger(logger any)
// UseMetrics sets the metrics for the FileSystem client.
UseMetrics(metrics any)
// Connect establishes a connection to FileSystem and registers metrics using the provided configuration when the client was Created.
Connect()
}
type Logger ¶
type Logger interface {
Debug(args ...any)
Debugf(format string, args ...any)
Info(args ...any)
Infof(format string, args ...any)
Error(args ...any)
Errorf(format string, args ...any)
Warn(args ...any)
Warnf(format string, args ...any)
}
Logger interface is used by datasource packages to log information about query execution. Developer Notes: Note that it's a reduced version of logging.Logger interface. We are not using that package to ensure that datasource package is not dependent on logging package. That way logging package should be easily able to import datasource package and provide a different "pretty" version for different log types defined here while avoiding the cyclical import issue. Idiomatically, interfaces should be defined by packages who are using it; unlike other languages. Also - accept interfaces, return concrete types.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package file is a generated GoMock package.
|
Package file is a generated GoMock package. |
|
Package pubsub provides a foundation for implementing pub/sub clients for various message brokers such as google pub-sub, kafka and MQTT.
|
Package pubsub provides a foundation for implementing pub/sub clients for various message brokers such as google pub-sub, kafka and MQTT. |
|
google
Package google provides a client for interacting with Google Cloud Pub/Sub.This package facilitates interaction with Google Cloud Pub/Sub, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
|
Package google provides a client for interacting with Google Cloud Pub/Sub.This package facilitates interaction with Google Cloud Pub/Sub, allowing publishing and subscribing to topics, managing subscriptions, and handling messages. |
|
kafka
Package kafka provides a client for interacting with Apache Kafka message queues.This package facilitates interaction with Apache Kafka, allowing publishing and subscribing to topics, managing consumer groups, and handling messages.
|
Package kafka provides a client for interacting with Apache Kafka message queues.This package facilitates interaction with Apache Kafka, allowing publishing and subscribing to topics, managing consumer groups, and handling messages. |
|
mqtt
Package mqtt provides a client for interacting with MQTT message brokers.This package facilitates interaction with MQTT brokers, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
|
Package mqtt provides a client for interacting with MQTT message brokers.This package facilitates interaction with MQTT brokers, allowing publishing and subscribing to topics, managing subscriptions, and handling messages. |
|
Package redis provides a client for interacting with Redis key-value stores.This package allows creating and managing Redis clients, executing Redis commands, and handling connections to Redis databases.
|
Package redis provides a client for interacting with Redis key-value stores.This package allows creating and managing Redis clients, executing Redis commands, and handling connections to Redis databases. |
|
Package sql provides functionalities to interact with SQL databases using the database/sql package.This package includes a wrapper around sql.DB and sql.Tx to provide additional features such as query logging, metrics recording, and error handling.
|
Package sql provides functionalities to interact with SQL databases using the database/sql package.This package includes a wrapper around sql.DB and sql.Tx to provide additional features such as query logging, metrics recording, and error handling. |
|
qb
Package qb provides SQL query builder utilities for dynamic WHERE/ORDER/GROUP/LIMIT style queries and bulk insert/update/delete statements.
|
Package qb provides SQL query builder utilities for dynamic WHERE/ORDER/GROUP/LIMIT style queries and bulk insert/update/delete statements. |