Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: theopenlane/utils
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.1
Choose a base ref
...
head repository: theopenlane/utils
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Nov 19, 2024

  1. allow max connections to be set on test db container (#35)

    * allow max connections to be set on test db container
    
    Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
    
    * no more magic numbers
    
    Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
    
    ---------
    
    Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
    golanglemonade authored Nov 19, 2024
    Copy the full SHA
    311368d View commit details

Commits on Nov 23, 2024

  1. update buildkite pipeline, readme, go version (#37)

    Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
    golanglemonade authored Nov 23, 2024
    Copy the full SHA
    acca03b View commit details
  2. Update anchore/sbom-action action to v0.17.8 (#36)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 23, 2024
    Copy the full SHA
    d399ec4 View commit details

Commits on Nov 26, 2024

  1. Update module github.com/stretchr/testify to v1.10.0 (#38)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 26, 2024
    Copy the full SHA
    be1001e View commit details

Commits on Dec 2, 2024

  1. Update module modernc.org/sqlite to v1.34.2 (#39)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    f1778c7 View commit details

Commits on Dec 6, 2024

  1. Update module golang.org/x/crypto to v0.30.0 (#40)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 6, 2024
    Copy the full SHA
    78571ec View commit details

Commits on Dec 8, 2024

  1. Copy the full SHA
    26bbb15 View commit details

Commits on Dec 9, 2024

  1. do not import the drivers in tests (#42)

    Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
    golanglemonade authored Dec 9, 2024
    Copy the full SHA
    296eff7 View commit details

Commits on Dec 11, 2024

  1. Copy the full SHA
    c64b3b3 View commit details

Commits on Dec 14, 2024

  1. Update anchore/sbom-action action to v0.17.9 (#44)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 14, 2024
    Copy the full SHA
    f9a8612 View commit details

Commits on Dec 26, 2024

  1. Update module github.com/theopenlane/echox to v0.2.1 (#46)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 26, 2024
    Copy the full SHA
    43c17db View commit details

Commits on Jan 6, 2025

  1. Update module golang.org/x/crypto to v0.32.0 (#47)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 6, 2025
    Copy the full SHA
    33bb656 View commit details

Commits on Jan 12, 2025

  1. precommit, license, bk pipeline (#48)

    * precommit, license, bk pipeline
    
    * revert bk pipeline
    
    * bump dependency version, go version
    
    * bk go version
    matoszz authored Jan 12, 2025
    Copy the full SHA
    d7d9b1a View commit details

Commits on Jan 20, 2025

  1. Update module github.com/cenkalti/backoff/v5 to v5.0.1 (#49)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 20, 2025
    Copy the full SHA
    a9c5ef7 View commit details

Commits on Jan 24, 2025

  1. Update anchore/sbom-action action to v0.18.0 (#50)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 24, 2025
    Copy the full SHA
    26553d8 View commit details

Commits on Jan 25, 2025

  1. feat: keyring functions (#51)

    * feat: keyring functions
    
    Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
    
    * add mock for testing
    
    Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
    
    ---------
    
    Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
    golanglemonade authored Jan 25, 2025
    Copy the full SHA
    9c2123e View commit details

Commits on Jan 31, 2025

  1. fix(deps): update module github.com/brianvoe/gofakeit/v7 to v7.2.1 (#52)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 31, 2025
    Copy the full SHA
    244d9b7 View commit details

Commits on Feb 5, 2025

  1. chore(deps): update sigstore/cosign-installer action to v3.8.0 (#53)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 5, 2025
    Copy the full SHA
    35ad66b View commit details

Commits on Feb 8, 2025

  1. fix(deps): update module golang.org/x/crypto to v0.33.0 (#55)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 8, 2025
    Copy the full SHA
    2174bd5 View commit details
  2. chore(deps): update slsa-framework/slsa-verifier action to v2.7.0 (#54)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 8, 2025
    Copy the full SHA
    af29794 View commit details

Commits on Feb 10, 2025

  1. fix(deps): update module github.com/cenkalti/backoff/v5 to v5.0.2 (#56)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 10, 2025
    Copy the full SHA
    86a9e14 View commit details

Commits on Feb 24, 2025

  1. Copy the full SHA
    381f76e View commit details

Commits on Feb 25, 2025

  1. fix(deps): update module golang.org/x/crypto to v0.35.0 (#61)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 25, 2025
    Copy the full SHA
    03bfeef View commit details
  2. fix(deps): update module github.com/redis/go-redis/v9 to v9.7.1 (#59)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 25, 2025
    Copy the full SHA
    4afd252 View commit details
  3. chore(deps): update sigstore/cosign-installer action to v3.8.1 (#58)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 25, 2025
    Copy the full SHA
    317dbfe View commit details

Commits on Feb 27, 2025

  1. fix(deps): update module entgo.io/ent to v0.14.3 (#57)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 27, 2025
    Copy the full SHA
    e987c77 View commit details
31 changes: 10 additions & 21 deletions .buildkite/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ steps:
key: "lint"
plugins:
- docker#v5.12.0:
image: "registry.hub.docker.com/golangci/golangci-lint:v1.60.3"
image: "registry.hub.docker.com/golangci/golangci-lint:v1.63.4"
command: ["golangci-lint", "run", "-v", "--timeout", "10m", "--config", ".golangci.yaml", "--concurrency", "0"]
environment:
- "GOTOOLCHAIN=auto"
@@ -19,30 +19,18 @@ steps:
cancel_on_build_failing: true
plugins:
- docker#v5.12.0:
image: golang:1.23.1
image: golang:1.23.5
always-pull: true
command: ["go", "test", "-coverprofile=coverage.out", "./..."]
artifact_paths: ["coverage.out"]
- group: ":closed_lock_with_key: Security Checks"
depends_on: "tests"
key: "security"
steps:
- label: ":closed_lock_with_key: gosec"
key: "gosec"
plugins:
- docker#v5.12.0:
image: "securego/gosec:2.20.0"
command: ["-no-fail", "-exclude-generated", "-fmt sonarqube", "-out", "results.txt", "./..."]
environment:
- "GOTOOLCHAIN=auto"
artifact_paths: ["results.txt"]
- label: ":github: upload PR reports"
key: "scan-upload-pr"
if: build.pull_request.id != null
depends_on: ["gosec", "go_test"]
depends_on: ["go_test"]
plugins:
- artifacts#v1.9.4:
download: "results.txt"
- cluster-secrets#v1.0.0:
variables:
SONAR_TOKEN: SONAR_TOKEN
- artifacts#v1.9.4:
download: "coverage.out"
step: "go_test"
@@ -55,10 +43,11 @@ steps:
- label: ":github: upload reports"
key: "scan-upload"
if: build.branch == "main"
depends_on: ["gosec", "go_test"]
depends_on: ["go_test"]
plugins:
- artifacts#v1.9.4:
download: results.txt
- cluster-secrets#v1.0.0:
variables:
SONAR_TOKEN: SONAR_TOKEN
- artifacts#v1.9.4:
download: coverage.out
step: "go_test"
6 changes: 3 additions & 3 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -45,9 +45,9 @@ jobs:
go-version-file: 'go.mod'
cache: true
- name: Install Syft
uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7
uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0
- name: Install Cosign
uses: sigstore/cosign-installer@v3.7.0
uses: sigstore/cosign-installer@v3.8.1
- name: Run GoReleaser
id: run-goreleaser
uses: goreleaser/goreleaser-action@v6
@@ -95,7 +95,7 @@ jobs:
permissions: read-all
steps:
- name: Install the SLSA verifier
uses: slsa-framework/slsa-verifier/actions/installer@v2.6.0
uses: slsa-framework/slsa-verifier/actions/installer@v2.7.0
- name: Download assets
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -5,15 +5,15 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: detect-private-key
- repo: https://github.com/google/yamlfmt
rev: v0.13.0
rev: v0.15.0
hooks:
- id: yamlfmt
- repo: https://github.com/crate-ci/typos
rev: v1.24.1
rev: v1.29.4
hooks:
- id: typos
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 The Open Lane, Inc.
Copyright 2025 theopenlane, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<div align="center">

[![Build status](https://badge.buildkite.com/a3a38b934ca2bb7fc771e19bc5a986a1452fa2962e4e1c63bf.svg?branch=main)](https://buildkite.com/theopenlane/utils)
[![Go Reference](https://pkg.go.dev/badge/github.com/theopenlane/utils.svg)](https://pkg.go.dev/github.com/theopenlane/utils)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache2.0-brightgreen.svg)](https://opensource.org/licenses/Apache-2.0)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=theopenlane_utils&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=theopenlane_util

</div>

# utils

Utilities for working within the openlane ecosystem
Utilities for working within the openlane ecosystem
6 changes: 6 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -12,6 +12,12 @@ tasks:
cmds:
- golangci-lint run --config=.golangci.yaml --verbose --fast --fix

go:lint:ci:
desc: runs golangci-lint, the most annoying opinionated linter ever, for CI
## do not use --fast or --fix in CI
cmds:
- golangci-lint run --config=.golangci.yaml --verbose

go:fmt:
desc: format all go code
cmds:
54 changes: 54 additions & 0 deletions contextx/contextx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package contextx

import (
"context"
)

// key is a unique type that we can use as a key in a context
type key[T any] struct{}

// With returns a copy of parent that contains the given value which can be retrieved by calling From with the resulting context
// The function uses a generic key type to ensure that the stored value is type-safe and can be uniquely identified and retrieved without
// risk of key collisions
func With[T any](ctx context.Context, v T) context.Context {
return context.WithValue(ctx, key[T]{}, v)
}

// From returns the value associated with the wanted type from the context
// It performs a type assertion to convert the value to the desired type T
// If the type assertion is successful, it returns the value and true
// If the type assertion fails, it returns the zero value of type T and false
func From[T any](ctx context.Context) (T, bool) {
v, ok := ctx.Value(key[T]{}).(T)

return v, ok
}

// MustFrom is similar to from, except that it panics if the type assertion fails / the value is not in the context
func MustFrom[T any](ctx context.Context) T {
return ctx.Value(key[T]{}).(T)
}

// FromOr returns the value associated with the wanted type or the given default value if the type is not found
// This function is useful when you want to ensure that a value is always returned from the context, even if the
// context does not contain a value of the desired type. By providing a default value, you can avoid handling
// the case where the value is missing and ensure that your code has a fallback value to use
func FromOr[T any](ctx context.Context, def T) T {
v, ok := From[T](ctx)
if !ok {
return def
}

return v
}

// FromOrFunc returns the value associated with the wanted type or the result of the given function if the type is not found
// This function is useful when the default value is expensive to compute or when the default value depends on some runtime conditions
func FromOrFunc[T any](ctx context.Context, f func() T) T {
v, ok := From[T](ctx)
if !ok {
return f()
}

return v
}
102 changes: 102 additions & 0 deletions contextx/contextx_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package contextx

import (
"context"
"reflect"
"testing"
)

func TestNormalOperation(t *testing.T) {
ctx := context.Background()
ctx = With(ctx, 10)

if MustFrom[int](ctx) != 10 {
t.FailNow()
}

if _, ok := From[float64](ctx); ok {
t.FailNow()
}
}

func TestIsolatedFromExplicitTypeReflection(t *testing.T) {
ctx := context.Background()

ctx = With(ctx, 10)

ctx = context.WithValue(ctx, reflect.TypeOf(20), 20)

if MustFrom[int](ctx) != 10 {
t.FailNow()
}
}

func TestPanicIfNoValue(t *testing.T) {
defer func() {
if recover() == nil {
t.FailNow()
}
}()

MustFrom[int](context.Background())
}

type x interface {
a()
}

type y struct{ v int }

func (y) a() {}

type z struct{ f func() }

func (z z) a() { z.f() }

func TestShouldWorkOnInterface(t *testing.T) {
var a x = y{10}

ctx := context.Background()
ctx = With(ctx, a)

b := MustFrom[x](ctx)
if b.(y).v != 10 {
t.FailNow()
}

r := ""
a = z{func() { r = "hello" }}

ctx = With(ctx, a)

MustFrom[x](ctx).a()

if r != "hello" {
t.FailNow()
}
}
func TestFromOr(t *testing.T) {
ctx := context.Background()
ctx = With(ctx, 10)

if FromOr(ctx, 20) != 10 {
t.FailNow()
}

if FromOr(context.Background(), 20) != 20 {
t.FailNow()
}
}

func TestFromOrFunc(t *testing.T) {
ctx := context.Background()
ctx = With(ctx, 10)

if FromOrFunc(ctx, func() int { return 20 }) != 10 {
t.FailNow()
}

if FromOrFunc(context.Background(), func() int { return 20 }) != 20 {
t.FailNow()
}
}
8 changes: 8 additions & 0 deletions contextx/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Package contextx is a helper package for managing context values
// Most **request-scoped data** is a singleton per request
// That is, it doesn't make sense for a request to carry around multiple loggers, users, traces
// you want to carry the _same one_ with you from function call to function call
// the way we've handled this historically is a separate context key per type you want to carry in the struct
// but with generics, instead of having to make a new zero-sized type for every struct
// we can just make a single generic type and use it for everything which is what this helper package is intended to do
package contextx
39 changes: 14 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,64 +1,53 @@
module github.com/theopenlane/utils

go 1.23.1
go 1.23.5

require (
entgo.io/ent v0.14.1
github.com/brianvoe/gofakeit/v7 v7.1.2
github.com/cenkalti/backoff/v4 v4.3.0
entgo.io/ent v0.14.3
github.com/brianvoe/gofakeit/v7 v7.2.1
github.com/cenkalti/backoff/v5 v5.0.2
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.24
github.com/oklog/ulid/v2 v2.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/ory/dockertest v3.3.5+incompatible
github.com/redis/go-redis/v9 v9.7.0
github.com/redis/go-redis/v9 v9.7.1
github.com/rs/zerolog v1.33.0
github.com/stoewer/go-strcase v1.3.0
github.com/stretchr/testify v1.9.0
github.com/theopenlane/echox v0.2.0
github.com/tursodatabase/libsql-client-go v0.0.0-20240902231107-85af5b9d094d
golang.org/x/crypto v0.29.0
modernc.org/sqlite v1.34.1
github.com/stretchr/testify v1.10.0
github.com/theopenlane/echox v0.2.1
github.com/zalando/go-keyring v0.2.6
golang.org/x/crypto v0.35.0
)

require (
al.essio.dev/pkg/shellescape v1.5.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coder/websocket v1.8.12 // indirect
github.com/containerd/continuity v0.4.3 // indirect
github.com/danieljoos/wincred v1.2.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.1.14 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools v2.2.0+incompatible // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.55.3 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)
102 changes: 32 additions & 70 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
entgo.io/ent v0.14.1 h1:fUERL506Pqr92EPHJqr8EYxbPioflJo6PudkrEA8a/s=
entgo.io/ent v0.14.1/go.mod h1:MH6XLG0KXpkcDQhKiHfANZSzR55TJyPL5IGNpI8wpco=
al.essio.dev/pkg/shellescape v1.5.1 h1:86HrALUujYS/h+GtqoB26SBEdkWfmMI6FubjXlsXyho=
al.essio.dev/pkg/shellescape v1.5.1/go.mod h1:6sIqp7X2P6mThCQ7twERpZTuigpr6KbZWtls1U8I890=
entgo.io/ent v0.14.3 h1:wokAV/kIlH9TeklJWGGS7AYJdVckr0DloWjIcO9iIIQ=
entgo.io/ent v0.14.3/go.mod h1:aDPE/OziPEu8+OWbzy4UlvWmD2/kbRuWfK2A40hcxJM=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
github.com/brianvoe/gofakeit/v7 v7.1.2 h1:vSKaVScNhWVpf1rlyEKSvO8zKZfuDtGqoIHT//iNNb8=
github.com/brianvoe/gofakeit/v7 v7.1.2/go.mod h1:QXuPeBw164PJCzCUZVmgpgHJ3Llj49jSLVkKPMtxtxA=
github.com/brianvoe/gofakeit/v7 v7.2.1 h1:AGojgaaCdgq4Adzrd2uWdbGNDyX6MWNhHdQBraNfOHI=
github.com/brianvoe/gofakeit/v7 v7.2.1/go.mod h1:QXuPeBw164PJCzCUZVmgpgHJ3Llj49jSLVkKPMtxtxA=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8=
github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8=
github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/danieljoos/wincred v1.2.2 h1:774zMFJrqaeYCK2W57BgAem/MLi6mtSE47MB6BOJ0i0=
github.com/danieljoos/wincred v1.2.2/go.mod h1:w7w4Utbrz8lqeMbDAK0lkNJUv5sAOkFi7nd/ogr0Uh8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
@@ -35,19 +35,17 @@ github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo=
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI=
github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
@@ -61,8 +59,6 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/oklog/ulid/v2 v2.1.0 h1:+9lhoxAP56we25tyYETBBY1YLA2SaoLvUFgrP2miPJU=
github.com/oklog/ulid/v2 v2.1.0/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
@@ -81,10 +77,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/redis/go-redis/v9 v9.7.1 h1:4LhKRCIduqXqtvCUlaq9c8bdHOkICjDMrr1+Zb3osAc=
github.com/redis/go-redis/v9 v9.7.1/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
@@ -98,67 +92,35 @@ github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8w
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/theopenlane/echox v0.2.0 h1:s9DJJrsLOSPsXVfgmQxgXmSVtxzztBnSmcVX4ax7tIM=
github.com/theopenlane/echox v0.2.0/go.mod h1:nfxwQpwvqYYI/pFHJKDs3/HLvjYKEGCih4XDgLSma64=
github.com/tursodatabase/libsql-client-go v0.0.0-20240902231107-85af5b9d094d h1:dOMI4+zEbDI37KGb0TI44GUAwxHF9cMsIoDTJ7UmgfU=
github.com/tursodatabase/libsql-client-go v0.0.0-20240902231107-85af5b9d094d/go.mod h1:l8xTsYB90uaVdMHXMCxKKLSgw5wLYBwBKKefNIUnm9s=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw=
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/theopenlane/echox v0.2.1 h1:ZhVkimmWxpKITf67oM57SrLWeIdnV8+dNXlC+VzlRaQ=
github.com/theopenlane/echox v0.2.1/go.mod h1:4j/Hx0uoLk5gVzdA83Qqz7xBEmqpoEP+OnzVaw2p6/o=
github.com/zalando/go-keyring v0.2.6 h1:r7Yc3+H+Ux0+M72zacZoItR3UDxeWfKTcabvkI8ua9s=
github.com/zalando/go-keyring v0.2.6/go.mod h1:2TCrxYrbUNYfNS/Kgy/LSrkSQzZ5UPVH85RwfczwvcI=
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ=
modernc.org/cc/v4 v4.21.4/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ=
modernc.org/ccgo/v4 v4.19.2 h1:lwQZgvboKD0jBwdaeVCTouxhxAyN6iawF3STraAal8Y=
modernc.org/ccgo/v4 v4.19.2/go.mod h1:ysS3mxiMV38XGRTTcgo0DQTeTmAO4oCmJl1nX9VFI3s=
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw=
modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U=
modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w=
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss=
modernc.org/sqlite v1.34.1 h1:u3Yi6M0N8t9yKRDwhXcyp1eS5/ErhPTBggxWFuR6Hfk=
modernc.org/sqlite v1.34.1/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
2 changes: 2 additions & 0 deletions keyring/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// package keyring allows for quick and easy access to the system keyring service.
package keyring
41 changes: 41 additions & 0 deletions keyring/keyring.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package keyring

import (
"errors"
"fmt"

"github.com/zalando/go-keyring"
)

var (
ErrNoResultsFound error = errors.New("no results found")
)

// QueryKeyring queries the keyring for the first item with the given service and account
// and return the password as a string
func QueryKeyring(service, account string) (string, error) {
result, err := keyring.Get(service, account)
if err != nil {
return "", err
}

if result == "" {
return "", fmt.Errorf("%w for account %s", ErrNoResultsFound, account)
}

return result, nil
}

// SetKeying sets the keyring with the given service, account and secret
func SetKeying(service, account string, secret []byte) error {
if err := keyring.Set(service, account, string(secret)); err != nil {
return err
}

return nil
}

// DeleteKeyring deletes the keyring with the given service and account
func DeleteKeyring(service, account string) error {
return keyring.Delete(service, account)
}
46 changes: 46 additions & 0 deletions keyring/keyring_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//go:build darwin
// +build darwin

package keyring

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zalando/go-keyring"
)

func TestKeying(t *testing.T) {
keyring.MockInit()

service := "test-service-1"
account := "test-account-1"
passwd := "test-password"

// cleanup
defer DeleteKeyring(service, account) //nolint:errcheck

err := SetKeying(service, account, []byte(passwd))
require.NoError(t, err)

result, err := QueryKeyring(service, account)
require.NoError(t, err)

assert.Equal(t, passwd, result)

// update password
updatedPasswd := "updated-password"
err = SetKeying(service, account, []byte(updatedPasswd))
require.NoError(t, err)

result, err = QueryKeyring(service, account)
require.NoError(t, err)

assert.Equal(t, updatedPasswd, result)

// bad query
result, err = QueryKeyring("meows", "eddy")
require.Error(t, err)
assert.Empty(t, result)
}
2 changes: 1 addition & 1 deletion marionette/marionette_test.go
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/cenkalti/backoff/v5"
"github.com/stretchr/testify/require"

"github.com/theopenlane/utils/marionette"
2 changes: 1 addition & 1 deletion marionette/options.go
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import (
"context"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/cenkalti/backoff/v5"
)

// Option configures the task beyond the input context allowing for retries or backoff
2 changes: 1 addition & 1 deletion marionette/options_test.go
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import (
"testing"
"time"

backoff "github.com/cenkalti/backoff/v4"
backoff "github.com/cenkalti/backoff/v5"
"github.com/stretchr/testify/require"
)

2 changes: 1 addition & 1 deletion marionette/tasks.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import (
"fmt"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/cenkalti/backoff/v5"
"github.com/oklog/ulid/v2"
"github.com/rs/zerolog/log"
)
3 changes: 1 addition & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -12,5 +12,4 @@ sonar.test.inclusions=**/*_test.go
sonar.test.exclusions=**/vendor/**

sonar.sourceEncoding=UTF-8
sonar.go.coverage.reportPaths=coverage.out
sonar.externalIssuesReportPaths=results.txt
sonar.go.coverage.reportPaths=coverage.out
84 changes: 66 additions & 18 deletions testutils/db.go
Original file line number Diff line number Diff line change
@@ -12,25 +12,66 @@ import (
_ "github.com/lib/pq"
"github.com/ory/dockertest"
"github.com/ory/dockertest/docker"
_ "github.com/tursodatabase/libsql-client-go/libsql"
_ "modernc.org/sqlite"
)

const (
defaultMaxConn = 100
defaultExpiryMinutes = 5
)

// Option is a functional option for configuring the DBConfig
type Option func(*DBConfig)

// TestFixture is a struct that holds the pool, resource and URI for the database
type TestFixture struct {
Pool *dockertest.Pool
resource *dockertest.Resource
URI string
Dialect string
}

// DBConfig is a struct that holds the configuration for the database
type DBConfig struct {
// image is the docker image to use
image string

// expiry is the duration after which the container will be killed
expiry time.Duration

// maxConn is the maximum number of connections to the database
// defaults to 100
maxConn int
}

// WithImage sets the image used for docker tests
func WithImage(image string) Option {
return func(c *DBConfig) {
c.image = image
}
}

// WithExpiryMinutes sets the expiration of the container, defaults to 10 minutes
func WithExpiryMinutes(expiry int) Option {
return func(c *DBConfig) {
c.expiry = time.Duration(expiry) * time.Minute
}
}

// WithMaxConn sets the max connections to the db container, defaults to 100
func WithMaxConn(maxConn int) Option {
return func(c *DBConfig) {
c.maxConn = maxConn
}
}

func TeardownFixture(tf *TestFixture) {
if tf.Pool != nil {
if err := tf.Pool.Purge(tf.resource); err != nil {
log.Fatalf("Could not purge resource: %s", err)
}
}
}
func GetPostgresDockerTest(image string, expiry time.Duration) (*TestFixture, error) {
func GetPostgresDockerTest(image string, expiry time.Duration, maxConn int) (*TestFixture, error) {
pool, err := dockertest.NewPool("")
if err != nil {
return nil, err
@@ -53,6 +94,7 @@ func GetPostgresDockerTest(image string, expiry time.Duration) (*TestFixture, er
&dockertest.RunOptions{
Repository: defaultImg,
Tag: imgTag,
Cmd: []string{"postgres", "-c", fmt.Sprintf("max_connections=%d", maxConn)},
Env: []string{
fmt.Sprintf("POSTGRES_PASSWORD=%s", password),
fmt.Sprintf("POSTGRES_USER=%s", user),
@@ -106,32 +148,38 @@ func GetPostgresDockerTest(image string, expiry time.Duration) (*TestFixture, er
}, nil
}

func getTestDB(u string, expiry time.Duration) (*TestFixture, error) {
func getTestDB(u string, expiry time.Duration, maxConn int) (*TestFixture, error) {
switch {
case strings.HasPrefix(u, "postgres"):
return GetPostgresDockerTest(u, expiry)
return GetPostgresDockerTest(u, expiry, maxConn)
default:
return nil, newURIError(u)
}
}

// GetTestURI returns the dialect, connection string and if used a testcontainer for database connectivity in tests
func GetTestURI(u string, expiryMinutes int) *TestFixture {
func GetTestURI(opts ...Option) *TestFixture {
config := &DBConfig{
maxConn: defaultMaxConn, // default to 100
expiry: time.Duration(defaultExpiryMinutes) * time.Minute, // default to 5 minutes
}

for _, opt := range opts {
opt(config)
}

switch {
case strings.HasPrefix(u, "sqlite://"):
case strings.HasPrefix(config.image, "sqlite://"):
// return dialect.SQLite, strings.TrimPrefix(u, "sqlite://")
return &TestFixture{Dialect: dialect.SQLite, URI: strings.TrimPrefix(u, "sqlite://")}
case strings.HasPrefix(u, "libsql://"):
return &TestFixture{Dialect: dialect.SQLite, URI: strings.TrimPrefix(config.image, "sqlite://")}
case strings.HasPrefix(config.image, "libsql://"):
// return dialect.SQLite, strings.TrimPrefix(u, "libsql://")
return &TestFixture{Dialect: "libsql", URI: strings.TrimPrefix(u, "libsql://")}
case strings.HasPrefix(u, "postgres://"), strings.HasPrefix(u, "postgresql://"):
return &TestFixture{Dialect: "libsql", URI: strings.TrimPrefix(config.image, "libsql://")}
case strings.HasPrefix(config.image, "postgres://"), strings.HasPrefix(config.image, "postgresql://"):
// return dialect.Postgres, u
return &TestFixture{Dialect: dialect.Postgres, URI: u}
case strings.HasPrefix(u, "docker://"):
// set reasonable expiry for docker test containers
expiry := time.Duration(expiryMinutes) * time.Minute

tf, err := getTestDB(strings.TrimPrefix(u, "docker://"), expiry)
return &TestFixture{Dialect: dialect.Postgres, URI: config.image}
case strings.HasPrefix(config.image, "docker://"):
tf, err := getTestDB(strings.TrimPrefix(config.image, "docker://"), config.expiry, config.maxConn)
if err != nil {
panic(err)
}
@@ -140,6 +188,6 @@ func GetTestURI(u string, expiryMinutes int) *TestFixture {

return tf
default:
panic("invalid DB URI, uri: " + u)
panic("invalid DB URI, uri: " + config.image)
}
}