rds

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package rds is the trumpet line of this operation -- blasts your SQL queries through the AWS RDS Data API and brings the results back home. Handles the connection, executes the statements, and stamps each query with a ska legend so you can track your pressings through the collection.

Index

Constants

View Source
const MaxQuerySize = 65536

Variables

View Source
var (
	ErrQueryTooLong = fmt.Errorf("query size exceeds %d bytes", MaxQuerySize)
	ErrQueryIsEmpty = errors.New("query can't be empty")
)

Functions

func NewIDGenerator

func NewIDGenerator() *idGen

NewIDGenerator sets up a fresh generator seeded with the current time. Ready to rock from the moment you plug it in.

func NewIDGeneratorWithSeed

func NewIDGeneratorWithSeed(seed uint64) *idGen

NewIDGeneratorWithSeed is the soundcheck version -- lets you tune the RNG to a specific frequency, when you need your setlist to be reproducible, not random like a real punk show.

func ValidateClusterARN

func ValidateClusterARN(arn string) error

ValidateClusterARN checks if your cluster ARN is legit -- empty gets a pass, but a bogus venue means the gig's off before it starts.

func ValidateSecretARN

func ValidateSecretARN(arn string) error

ValidateSecretARN checks if your secret ARN passes muster -- empty is fine, but fake creds will get you slapped hard.

Types

type Client

type Client struct {
	ClientConfig
	// contains filtered or unexported fields
}

Client spins the decks -- your connection to the RDS Data API.

func NewClient

func NewClient(ctx context.Context, rider *ClientConfig) (*Client, error)

NewClient fires up the soundsystem -- one thing that you can depend on. Validates your rider, plugs into AWS, and gets the decks ready to spin.

func (*Client) ExecuteQuery

func (c *Client) ExecuteQuery(ctx context.Context, query *Query) error

ExecuteQuery drops the needle and lets it rip.

func (*Client) ExecuteSQL

func (c *Client) ExecuteSQL(ctx context.Context, sql string) (*Query, error)

ExecuteSQL is the one-shot single -- cue and play in one motion.

func (*Client) NewQuery

func (c *Client) NewQuery(sql string) (*Query, error)

NewQuery cues up a fresh track without hitting play.

type ClientConfig

type ClientConfig struct {
	ClusterARN string
	SecretARN  string
	Database   string
}

ConnectionInfo is your rider for the gig.

  • ClusterARN is the venue
  • SecretARN gets you through the door
  • Database is which stage you're playing

func (*ClientConfig) Validate

func (c *ClientConfig) Validate() error

Validate checks if you've got venue, credentials, and stage sorted -- can't start the show without all three.

type Query

type Query struct {
	CreatedAt time.Time
	Label     string
	SQL       string
	Result    *QueryResult
}

Query is a tune waiting to be played -- SQL on deck, result on standby.

type QueryResult

type QueryResult struct {
	Columns             []string
	Rows                [][]types.Field
	NumberOfRowsUpdated int64
}

QueryResult is what comes back from the pit.

  • SELECT fills the `Columns` and `Rows`
  • INSERT/UPDATE/DELETE counts the damage in `NumberOfRowsUpdated`

func BuildQueryResult

func BuildQueryResult(output *rdsdata.ExecuteStatementOutput) *QueryResult

BuildQueryResult masters the raw take from the soundboard -- pulls the setlist from metadata and presses the tracks into something you can spin.

func (*QueryResult) Message

func (qr *QueryResult) Message() string

Message calls out what went down -- rows returned, rows wrecked, or just a nod that the set played clean.

Jump to

Keyboard shortcuts

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