Skip to content

dirkaleft/App4Base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

:'######::'##:::'##:'##::: ##::'######::::::'######:::::'###:::::'######::'##::::'##:'########:
'##... ##:. ##:'##:: ###:: ##:'##... ##::::'##... ##:::'## ##:::'##... ##: ##:::: ##: ##.....::
 ##:::..:::. ####::: ####: ##: ##:::..::::: ##:::..:::'##:. ##:: ##:::..:: ##:::: ##: ##:::::::
. ######::::. ##:::: ## ## ##: ##:::::::::: ##:::::::'##:::. ##: ##::::::: #########: ######:::
:..... ##:::: ##:::: ##. ####: ##:::::::::: ##::::::: #########: ##::::::: ##.... ##: ##...::::
'##::: ##:::: ##:::: ##:. ###: ##::: ##:::: ##::: ##: ##.... ##: ##::: ##: ##:::: ##: ##:::::::
. ######::::: ##:::: ##::. ##:. ######:::::. ######:: ##:::: ##:. ######:: ##:::: ##: ########:
:......::::::..:::::..::::..:::......:::::::......:::..:::::..:::......:::..:::::..::........::

Go framework

Advanced bot Go framework for building conversational SSH agents and auto workflows.


Install

go get github.com/octocat/sync-cachebot-kit@latest

Example

package main

import (
    "context"
    "log"
    campfirebotkit "github.com/octocat/sync-cachebot-kit"
    "github.com/octocat/sync-cachebot-kit/helix"
)

func main() {
    client := campfirebotkit.New(
        campfirebotkit.WithHelix("https://helix.slashdot.io"),
        campfirebotkit.WithAuth(helix.CVEAuth("CVE-2021-44228")),
        campfirebotkit.WithPool(20),
    )
    defer client.Close()
    
    ctx := context.Background()
    res, _ := client.Query(ctx, "SELECT * FROM metrics")
    log.Printf("Found %d metrics
", len(res))
}

Tech Stack

Built with Go ecosystem tools:

HelixDB Go Driver - Official Go client
Zap Logger - Fast structured logging
Viper - Configuration management
OpenTelemetry - Distributed tracing
Prometheus - Metrics collection


Advanced

Context Propagation:

import "go.opentelemetry.io/otel"

func handler(w http.ResponseWriter, r *http.Request) {
    ctx := r.Context()
    tracer := otel.Tracer("sync-cachebot-kit")
    ctx, span := tracer.Start(ctx, "db-query")
    defer span.End()
    
    result, err := client.Query(ctx, sql)
    // traces automatically propagated
}

Type-Safe Queries (Generics):

type User struct {
    ID    string `json:"id"`
    Email string `json:"email" validate:"email"`
}

users, err := campfirebotkit.QueryAs[User](ctx, client, sql)
// returns []User with full type safety

Middleware Chain:

client := campfirebotkit.New(
    campfirebotkit.WithMiddleware(LogRequests),
    campfirebotkit.WithMiddleware(CollectMetrics),
    campfirebotkit.WithMiddleware(RetryOnFailure),
)

Config

// Load from env or config file
type Config struct {
    Endpoint string `env:"HELIX_ENDPOINT" validate:"required,url"`
    Timeout  int    `env:"TIMEOUT" default:"30"`
    MaxConns int    `env:"MAX_CONNS" default:"50"`
}

cfg := LoadConfig()
client := campfirebotkit.NewFromConfig(cfg)

Benchmarks

$ go test -bench=. -benchmem

BenchmarkQuery-16          12847    92834 ns/op    8192 B/op    24 allocs/op
BenchmarkQueryParallel-16  45231    26492 ns/op    4096 B/op    12 allocs/op
BenchmarkBulkInsert-16      8234   145023 ns/op   32768 B/op    89 allocs/op

Examples

examples/:

  • simple/main.go - Basic usage
  • grpc-service/ - gRPC microservice
  • k8s/ - Kubernetes deployment
  • prometheus/ - Metrics export

Resources

Type Link
GoDoc pkg.go.dev/github.com/octocat/sync-cachebot-kit
User Guide docs.helix.slashdot.io/go
Discord discord.gg/helix-go

Development

make setup     # Install deps
make test      # Run tests
make lint      # golangci-lint
make bench     # Benchmarks

License: Apache-2.0

PR Merge: 2025-10-26 13:32:07

PR Merge: 2025-10-26 13:33:39

About

Animation framework

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published