Documentation
¶
Overview ¶
Package storage wraps the Postgres pool and the S3-compatible object store. Both Open helpers run the necessary setup (migrations for Postgres; bucket creation for S3) so the caller only sees "ready" handles.
Index ¶
- func OpenPG(ctx context.Context, dbURL string) (*pgxpool.Pool, error)
- type ObjectStore
- func (s *ObjectStore) Exists(ctx context.Context, key string) (bool, error)
- func (s *ObjectStore) Get(ctx context.Context, key string) (io.ReadCloser, error)
- func (s *ObjectStore) Put(ctx context.Context, key string, body io.Reader, size int64) (string, error)
- func (s *ObjectStore) Remove(ctx context.Context, key string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ObjectStore ¶
ObjectStore wraps a minio-go client + bucket. The same code path works against MinIO, R2, B2, or AWS S3 — only the endpoint and credentials differ.
func OpenS3 ¶
func OpenS3(ctx context.Context, endpoint, accessKey, secretKey, bucket, region string, useSSL bool) (*ObjectStore, error)
OpenS3 connects to the configured S3-compatible endpoint and ensures the target bucket exists. Idempotent; safe to call on every boot.
func (*ObjectStore) Exists ¶
Exists reports whether an object is present under key. A "not found" response is reported as (false, nil); any other failure (network, auth) is returned as an error so callers can distinguish "absent" from "couldn't tell".
func (*ObjectStore) Get ¶
func (s *ObjectStore) Get(ctx context.Context, key string) (io.ReadCloser, error)
Get fetches an object. The caller MUST close the returned reader.