Skip to content

goal-web/supports

Repository files navigation

Goal-Supports

Go Reference Go Report Card License GitHub Stars Release Go Version CI Lint Commit Activity

Docs · Issues · Releases · 中文文档

Goal Supports provides common building blocks for Goal projects: type-safe field access (BaseFields), logging wrappers, command signature parsing, utilities, exceptions and signal providers.

Highlights

  • BaseFields: typed getters and optional defaults with provider pattern
  • Logging: structured logging with debug switch
  • Commands: DSL signature parsing, argument injection
  • Utils: conversions, reflection, files, random, maps, fields flattening
  • Exceptions/Signal: helpers and service providers

Compatibility

  • Go >= 1.25.0
  • Module path: github.com/goal-web/supports

Quick Start

package main

import (
    "github.com/goal-web/supports"
    "github.com/goal-web/supports/logs"
    "github.com/goal-web/supports/utils"
)

type provider struct{ supports.BaseFields }

func main() {
    p := &provider{}
    p.OptionalGetter = func(key string, defaultValue any) any { return defaultValue }

    v := p.StringOptional("app.name", "goal")
    logs.Default().WithField("name", v).Info("ready")

    f := utils.ToFields(map[string]any{"a": map[string]any{"b": 1}})
    utils.Flatten(make(map[string]any), f, ".")
}

Commands

sig := "demo {name} {count?} {--force} {--driver=aes}"
name, args := supports_commands.ParseSignature(sig)
_ = name
_ = args

Star History

Star History Chart

Stargazers over time

CI Insights

  • CI Status: CI
  • Lint Status: Lint
  • Commit Activity: Commit Activity
  • Last Commit: Last Commit

Contributing

  • Keep API backward compatible, update docs/examples for changes
  • Build and run tests before submitting
  • Use Issues/Discussions for proposals

Roadmap

  • More tests for commands/exceptions/signal
  • Example app and smoke tests
  • English/Chinese docs maintained

Changelog

Security

  • Do not commit secrets; prefer env vars or encrypted configs

FAQ

  • Use typed getters to avoid implicit conversions
  • Prefer local builds of tools aligned with target Go version

About

封装了超多好用的方法

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages