utilities

package module
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 27 Imported by: 2

README

Utilities for Go

Go Reference Go Reference (ginutils) Go Report Card CI Release

A small, focused collection of helper functions and type shortcuts frequently used across services. Utilities are grouped around a few common themes:

  • Pointers and generics helpers
  • Struct reflection helpers (read/write fields, mapping, tabular output)
  • CLI/table printing helpers
  • JWT helpers (create, validate, extract, gin integration)
  • Process/daemon helpers (PID discovery)
  • Host/filesystem helpers
  • File utilities (MIME type)
  • Network helpers (ARP lookup)
  • Validation helpers (email, IP, URL, FQDN/hostname, phone, credit card Luhn, UUID, base64, hex colors, alphanumeric)
  • Database DSN helper and driver.Valuer utilities
  • Common type aliases

This repository contains:

  • Root package: github.com/dan-sherwin/go-utilities
  • Subpackage: github.com/dan-sherwin/go-utilities/ginutils (gin-only JWT conveniences)

Installation

  • Root package: go get github.com/dan-sherwin/go-utilities

  • Gin helpers: go get github.com/dan-sherwin/go-utilities/ginutils

Go version: see go.mod (currently Go 1.24).

Quick Start

  • Create a JWT:

    token, err := utilities.GenerateJWT(struct{UserID string}{"123"}, time.Hour, []byte("secret"))

  • Validate & read claims:

    claims, err := utilities.ExtractJwtClaims(token, []byte("secret"))

  • Pointers:

    sPtr := utilities.Ptr("hello") // *string v := utilities.PtrVal(sPtr) // "hello" nonNil := utilities.PtrZeroNil(5) // *int isEq := utilities.PtrCompare(&v, &v) // true

  • Struct table printing:

    type User struct { ID int; Name string } _ = utilities.PrintStructTable([]User{{1, "Ada"}, {2, "Linus"}})

  • Process helpers:

    if utilities.DaemonAlreadyRunning("my-app") { /* ... */ } pid, err := utilities.FindDaemonProcessPID("my-app")

  • MIME type by filename:

    mime := utilities.MimeTypeFromExtension("photo.JPG") // image/jpeg

  • Network (ARP):

    mac, err := utilities.GetMacAddressFromIp("192.168.1.20")

  • Validation helpers:

    utilities.IsEmail("[email protected]") // true utilities.IsURL("https://example.com") // true utilities.IsCreditCard("4242 4242 4242 4242") // true (Luhn) utilities.IsIPv4("192.168.1.1") // true utilities.IsUUID("550e8400-e29b-41d4-a716-446655440000") // true

  • Gin integration:

    func handler(c *gin.Context) { claims, err := ginutils.ExtractJwtClaimsFromContext(c, []byte("secret")) // ... }

Package Layout

  • utilities: general-purpose helpers used across services.
  • utilities/ginutils: helpers for extracting JWTs from gin.Context Authorization headers.

Detailed API (Root package: utilities)

Below is a complete list of exported functions and types with concise descriptions. Examples above show typical usage.

Pointers and Value Utilities
  • func Ptr[T any](v T) *T Returns a pointer to v.
  • func PtrZeroNil[T any](v T) *T Returns &v if v is non-zero; otherwise nil.
  • func PtrVal[T any](p *T) T Dereferences p or returns zero value if p is nil.
  • func PtrCompare[T comparable](p1, p2 *T) bool True if both nil or both non-nil and equal.
  • func CopyIfNotNil[T any](src, dest *T) Copies *src into *dest if both are non-nil.
  • func CopyIfNotZero[T any](src T, dest *T) Copies src into *dest if src is non-zero and dest != nil.
  • func NilIfEmpty[T any](in []T) *[]T Returns nil if the slice is empty; otherwise pointer to the slice.
  • func NilIfZeroPtr[T comparable](in *T) *T Returns nil if in != nil and *in is zero; else returns in.
Struct Reflection Helpers
  • func ZeroStructFieldByName(ptr interface{}, fieldName string) error Sets named field to its zero value. ptr must be pointer to struct.
  • func SetStructFieldByName(ptr interface{}, fieldName string, value interface{}) error Sets named field to value with basic type checking.
  • func StructFieldNames(s interface{}) []string Returns field names of a struct or pointer to struct.
  • func StructToStringMap(s interface{}) map[string]string Maps field names to string values; dereferences pointers and marks nil pointers as "".
CLI/Table Helpers
  • func PrintMapArray(input any) error Prints a []map[string]any, []map[string]string, or []utilities.StrMap as a table to stdout.
  • func PrintStructMap(obj any) error Treats any map's values as structs and prints a table.
  • func PrintSortedStructMap(obj any) error Like PrintStructMap but sorts columns and rows for stable output.
  • func PrintStructTable(obj any) error Prints a struct or slice/array of structs (or pointers) as a table to stdout.
  • func PrintStringSlice(input any) error Prints a slice of strings with index.
  • func PrintAnySlice(input any) error Prints a slice of any type using fmt.Sprint.
  • func PrintMap(input any, headers ...string) error Prints a single map with optional headers.
  • func PrintStringsTable(headers []string, rows [][]string) error Renders arbitrary headers and rows.
  • func PrintSlice(input any) error Prints a slice/array determined via reflection.
JWT Helpers
  • func GenerateJWT(claims interface{}, duration time.Duration, secretKey []byte) (string, error) Creates a JWT (HS256) with iat and exp added.
  • func ValidateJWT(tokenString string, secretKey []byte) (*jwt.Token, error) Parses and validates an HS256 token.
  • func ExtractJwtClaims(tokenString string, secretKey []byte) (map[string]interface{}, error) Returns validated claims as a map.
  • func ExtractJwtClaimsInto(tokenString string, secretKey []byte, out interface{}) error Decodes validated claims into your struct.
Process/Daemon Helpers
  • func DaemonAlreadyRunning(appName string) bool True if a matching process already exists.
  • func MustFindDaemonProcessPID(appName string) int Returns PID if found; returns 0 if not found.
  • func FindDaemonProcessPID(appName string) (int, error) Cross-platform PID lookup (Linux /proc and macOS variant).
  • func FindDaemonProcessPIDWithArg(appName string, argName string) (int, error) As above; requires presence of argName in process args.
  • func FindProcessPIDMAC(appName string) (int, error) macOS-specific lookup using ps.
Host/Filesystem Helpers
  • func AmAdmin() bool True if running as root (euid == 0).
  • func DirCreateIfNotExists(dir string) error mkdir -p behavior with 0755 on missing dirs.
Debug Helpers
  • func LitterCheckErr[T any](out T, err error) T Dumps value with litter and logs an error if present, then returns out.
File Helpers
  • func MimeTypeFromExtension(filename string) string Returns MIME by extension; defaults to application/octet-stream.
Network Helpers
  • func GetMacAddressFromIp(ipAddress string) (string, error) Looks up MAC by IP using local ARP table.
Validation Helpers
  • func IsEmail(s string) bool Valid email using net/mail; ensures domain is FQDN/hostname or IP.
  • func IsIP(s string) bool IPv4 or IPv6 literal.
  • func IsIPv4(s string) bool IPv4 literal only.
  • func IsIPv6(s string) bool IPv6 literal only.
  • func IsMAC(s string) bool Hardware address (MAC-48/EUI-64).
  • func IsURL(s string) bool http/https URL with valid host (IPv4/IPv6/FQDN/hostname).
  • func IsFQDN(s string) bool Fully-qualified domain name per common DNS label rules.
  • func IsHostname(s string) bool Single-label hostnames, same label rules as FQDN labels.
  • func IsCreditCard(s string) bool Digits with optional spaces/dashes, validated via Luhn checksum.
  • func IsPhone(s string) bool Basic E.164 (+8..15 digits) or national digits (7..15).
  • func IsUUID(s string) bool UUID v1–v5 canonical format.
  • func IsBase64(s string) bool Base64 (padded or raw), ignoring whitespace.
  • func IsHexColor(s string) bool #RGB, #RRGGBB, #RGBA, #RRGGBBAA (with or without #).
  • func IsAlphaNumeric(s string) bool ASCII letters and digits only.
Database Helpers
  • type DbDSNConfig struct { Server string; Port int; Name string; User string; Password string; SSLMode bool; TimeZone string } Source values for DSN generation.
  • func DbDSN(cfg DbDSNConfig) string Assembles a postgres-style DSN from config.
  • func ToValuers[T driver.Valuer](in []T) []driver.Valuer Useful when building driver.Valuer slices (e.g., for WHERE IN bindings).
Map Helpers
  • func Merge[K comparable, V any](a, b map[K]V) map[K]V Returns a new map with values from b overwriting a.
  • func MergeInto[K comparable, V any](a, b map[K]V) Merges b into a in-place.
Common Type Aliases
  • General maps
    • type StrMap map[string]string
    • type StrAny map[string]any
    • type IntMap map[string]int
    • type AnyMap map[string]any
  • JSON
    • type JSON map[string]any
  • Slices
    • type Strs []string
    • type Ints []int
    • type Floats []float64
    • type Anys []any
  • Functions
    • type Handler func() error
    • type Callback func(any) error
    • type Predicate[T any] func(T) bool
    • type Mapper[T any, R any] func(T) R
  • Channels
    • type ErrChan chan error
    • type StrChan chan string
    • type AnyChan chan any

Subpackage: ginutils

Helpers for extracting JWTs from gin-gonic request contexts.

Import path: github.com/dan-sherwin/go-utilities/ginutils

  • func ExtractJwtClaimsFromContext(c *gin.Context, secretKey []byte) (map[string]interface{}, error) Reads Authorization: Bearer and returns validated claims.
  • func ExtractJwtClaimsFromContextInto(c *gin.Context, secretKey []byte, out interface{}) error As above, but decodes into your struct.
  • func ExtractCookieJwtClaimsFromContext(c *gin.Context, secretKey []byte) (map[string]interface{}, error) Reads Cookie token and returns validated claims.
  • func ExtractCookieJwtClaimsFromContextInto(c *gin.Context, secretKey []byte, out interface{}) error As above, but decodes into your struct.

Example:

r := gin.Default() r.GET("/me", func(c *gin.Context) { var claims struct{ UserID string json:"uid" } if err := ginutils.ExtractJwtClaimsFromContextInto(c, []byte("secret"), &claims); err != nil { c.AbortWithStatusJSON(401, gin.H{"error": "invalid token"}) return } c.JSON(200, gin.H{"user": claims.UserID}) })

Notes and Caveats

  • Security: JWT helpers use HS256. Ensure secret key management follows your org’s standards. Consider key rotation and short expirations.
  • Time: GenerateJWT injects iat and exp based on time.Now().
  • Process helpers: Linux uses /proc parsing; macOS uses ps output. Caller’s own PID is ignored. Provide the correct app name (and arg name when applicable).
  • Table printing: Helpers write to os.Stdout using tablewriter. In non-TTY contexts, ensure stdout capture is acceptable.
  • Network/ARP: GetMacAddressFromIp relies on local ARP cache; may fail if the IP has not been resolved on the local network.
  • DSN: DbDSN builds a PostgreSQL-like connection string; adjust as needed for your driver.

Versioning

This project follows Semantic Versioning. See CHANGELOG.md for a human‑friendly list of notable changes. The next release is expected to be v1.2.3 (documentation and CI only).

License

Released under the MIT License. See LICENSE for the full text.

Contributing

  • Keep functions small and well-documented (Go doc comments above declarations).
  • Prefer generic helpers where it improves ergonomics without obscuring types.
  • Add examples to this README when adding new exported functions.

Documentation

Overview

Package utilities provides a collection of small, focused helper functions and type shortcuts used across services, including validation, CLI/table printing, JWT, filesystem, network, and more.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AmAdmin

func AmAdmin() bool

AmAdmin checks if the current user has administrative (root) privileges by verifying if the effective user ID is 0. Returns true if the user is root; otherwise, false.

func ConvertToJSONMap

func ConvertToJSONMap(input any) (datatypes.JSONMap, error)

ConvertToJSONMap marshals the input value to JSON and unmarshals it into a datatypes.JSONMap. Returns an error if marshaling or unmarshaling fails.

func CopyIfNotNil

func CopyIfNotNil[T any](src, dest *T)

CopyIfNotNil copies the value from the source pointer to the destination pointer only if both pointers are non-nil. It uses PtrVal to dereference the source pointer safely.

func CopyIfNotZero

func CopyIfNotZero[T any](src T, dest *T)

CopyIfNotZero copies the value of src to dest if src is not the zero value of its type and dest is not nil. It uses PtrZeroNil to determine if src is non-zero.

func DaemonAlreadyRunning

func DaemonAlreadyRunning(appName string) bool

DaemonAlreadyRunning checks if a daemon process with the given appName is already running on the system. Returns true if the process exists, otherwise false.

func DbDSN

func DbDSN(cfg DbDSNConfig) string

DbDSN generates a database connection string (DSN) based on the provided configuration structure, including server, port, database name, user, password, SSL mode, and timezone. The SSL mode defaults to "enable" or "disable" based on the cfg.SSLMode flag.

func DirCreateIfNotExists

func DirCreateIfNotExists(dir string) error

DirCreateIfNotExists checks if a directory exists and creates it if it does not. It returns an error if there is an issue checking the directory or creating it.

func ExtractJwtClaims

func ExtractJwtClaims(tokenString string, secretKey []byte) (map[string]interface{}, error)

ExtractJwtClaims extracts claims from a JWT token string using the provided secret key. It returns the claims as a map if the token is valid, or an error if validation or extraction fails.

func ExtractJwtClaimsInto

func ExtractJwtClaimsInto(tokenString string, secretKey []byte, out interface{}) error

ExtractJwtClaimsInto extracts claims from a JWT token string, validates it using the provided secretKey, and maps the claims into the provided output struct. Returns an error if validation, marshalling, or unmarshalling fails.

func FindDaemonProcessPID

func FindDaemonProcessPID(appName string) (int, error)

FindDaemonProcessPID searches for the PID of a running daemon process matching the given appName. It checks the local process table on Linux and utilizes platform-specific logic for macOS. Returns the PID of the found process or an error if the process is not found or on failure.

func FindDaemonProcessPIDWithArg

func FindDaemonProcessPIDWithArg(appName string, argName string) (int, error)

FindDaemonProcessPIDWithArg searches for the PID of a running daemon process matching the given appName and given argument. It checks the local process table on Linux and utilizes platform-specific logic for macOS. Returns the PID of the found process or an error if the process is not found or on failure.

func FindProcessPIDMAC

func FindProcessPIDMAC(appName string) (int, error)

FindProcessPIDMAC searches for a specific process by name on macOS and returns its PID. It filters processes using the `ps` command, ignoring the caller's own PID, and matches the process name and argument. Returns the PID of the found process or an error if the process is not found.

func GenerateJWT

func GenerateJWT(claims interface{}, duration time.Duration, secretKey []byte) (string, error)

GenerateJWT creates a JSON Web Token (JWT) with the specified claims and expiration duration using the provided secret key. It embeds issued-at (iat) and expiration (exp) fields into the claims automatically. Returns the signed JWT string or an error if the operation fails.

func GetMacAddressFromIp

func GetMacAddressFromIp(ipAddress string) (string, error)

GetMacAddressFromIp retrieves the MAC address associated with the given IP address by parsing the ARP table. Returns the MAC address as a string if found, otherwise returns an error if the IP is invalid or no matching MAC address is found.

revive:disable-next-line var-naming // keep exported name for API compatibility

func IsAlphaNumeric

func IsAlphaNumeric(s string) bool

IsAlphaNumeric reports whether s is composed only of ASCII letters and digits.

func IsBase64

func IsBase64(s string) bool

IsBase64 checks if s is valid base64 without requiring specific padding, ignoring whitespace.

func IsCreditCard

func IsCreditCard(s string) bool

IsCreditCard performs a format check (digits with optional separators) and Luhn checksum.

func IsEmail

func IsEmail(s string) bool

IsEmail returns true if s is a valid email address per net/mail parsing. It accepts common real-world emails but does not guarantee full RFC compliance.

func IsFQDN

func IsFQDN(s string) bool

IsFQDN returns true if s is a fully qualified domain name per common DNS label rules.

func IsHexColor

func IsHexColor(s string) bool

IsHexColor returns true if s represents a hex color in one of the supported forms: #RGB, #RRGGBB, #RGBA, #RRGGBBAA (with or without the leading #).

func IsHostname

func IsHostname(s string) bool

IsHostname allows single-label hostnames (non-FQDN), same label rules as FQDN labels.

func IsIP

func IsIP(s string) bool

IsIP returns true if s is a valid IPv4 or IPv6 address literal.

func IsIPv4

func IsIPv4(s string) bool

IsIPv4 returns true if s is a valid IPv4 address literal.

func IsIPv6

func IsIPv6(s string) bool

IsIPv6 returns true if s is a valid IPv6 address literal.

func IsMAC

func IsMAC(s string) bool

IsMAC returns true if s is a valid MAC-48 or EUI-64 hardware address.

func IsPhone

func IsPhone(s string) bool

IsPhone returns true for basic phone numbers: E.164 (+8..15 digits) or national digits (7..15).

func IsURL

func IsURL(s string) bool

IsURL returns true if s is a valid HTTP or HTTPS URL with a host.

func IsUUID

func IsUUID(s string) bool

IsUUID returns true if s matches a UUID v1–v5 in canonical form.

func LitterCheckErr

func LitterCheckErr[T any](out T, err error) T

LitterCheckErr logs an error if present, outputs a debug dump of the provided value using the litter library, and then returns the value.

func Merge

func Merge[K comparable, V any](a, b map[K]V) map[K]V

Merge returns a new map that contains all key-value pairs from a and b. If a key exists in both, the value from b takes precedence.

func MergeInto

func MergeInto[K comparable, V any](a, b map[K]V)

MergeInto merges all key-value pairs from b into a in place. If a key exists in both, the value from b takes precedence.

func MimeTypeFromExtension

func MimeTypeFromExtension(filename string) string

MimeTypeFromExtension returns the MIME type based on the file extension. Defaults to "application/octet-stream" if unknown.

func MustFindDaemonProcessPID

func MustFindDaemonProcessPID(appName string) int

MustFindDaemonProcessPID retrieves the PID of a running daemon process for the given appName or returns 0 if not found. It panics if an error occurs during the search, enforcing that the process must be found.

func NilIfEmpty

func NilIfEmpty[T any](in []T) *[]T

NilIfEmpty takes a slice of any type and returns nil if the slice is empty, or a pointer to the slice otherwise.

func NilIfZeroPtr

func NilIfZeroPtr[T comparable](in *T) *T

NilIfZeroPtr returns nil if the input pointer is non-nil and the value it points to is zero; otherwise, it returns the input pointer unchanged.

func PrintAnySlice

func PrintAnySlice(input any) error

PrintAnySlice prints a one-column table of a []any or utilities.Anys with row numbers. Values are stringified using fmt.Sprintf("%v", v).

func PrintMap

func PrintMap(input any, headers ...string) error

PrintMap prints a two-column table for any map type. It accepts maps with any key and value types (including pointers to maps). Keys are ordered by their string representation for stable output. Optional headers can be provided: headers[0] for the key column, headers[1] for the value column.

func PrintMapArray

func PrintMapArray(input any) error

PrintMapArray takes an input of type any, attempts to interpret it as a slice of maps with string keys and values of any type, and prints it as a formatted table. Returns an error if the input is of unsupported type or is an empty slice.

func PrintSlice

func PrintSlice(input any) error

PrintSlice prints any slice or array (of basic types or structs) as a two-column table of index and value. For struct elements, it will use fmt.Sprintf("%v", elem). For slices of structs requiring field breakdown, use PrintStructTable instead.

func PrintSortedStructMap

func PrintSortedStructMap(obj any) error

PrintSortedStructMap takes any map as input and prints its values in a tabular format by treating them as structs. It behaves like PrintStructMap but sorts the output by the map key before printing.

func PrintStringSlice

func PrintStringSlice(input any) error

PrintStringSlice prints a one-column table of a []string or utilities.Strs with row numbers. Returns an error if the input slice is empty or of unsupported type.

func PrintStringsTable

func PrintStringsTable(headers []string, rows [][]string) error

PrintStringsTable prints a table for a [][]string with optional headers. If headers is nil or empty, rows are printed without a header. Returns an error if rows is empty or contains inconsistent column counts when headers are provided.

func PrintStructMap

func PrintStructMap(obj any) error

PrintStructMap takes any map as input and prints its values in a tabular format by treating them as structs. Returns an error if the input is not a map or if any issues occur during processing.

func PrintStructTable

func PrintStructTable(obj any) error

PrintStructTable prints a tabular representation of a struct or a slice/array of structs to the standard output. It requires the input to be a struct, or a slice/array containing structs or pointers to structs. Returns an error if input is invalid or processing fails.

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to the given value of a generic type T.

func PtrCompare

func PtrCompare[T comparable](p1, p2 *T) bool

PtrCompare compares two pointers of any comparable type and returns true if both are nil or if they point to equal values. Returns false if one pointer is nil or they point to unequal values.

func PtrVal

func PtrVal[T any](p *T) T

PtrVal dereferences a pointer and returns its value; if the pointer is nil, it returns the zero value of the type.

func PtrZeroNil

func PtrZeroNil[T any](v T) *T

PtrZeroNil returns a pointer to the input value if it is non-zero; otherwise, it returns nil. It uses reflection to determine whether the input value equals its type's zero value.

func SetStructFieldByName

func SetStructFieldByName(ptr interface{}, fieldName string, value interface{}) error

SetStructFieldByName sets the value of a field in a struct identified by its name. The function expects a pointer to a struct, the field name as a string, and the value to set. It returns an error if the pointer is not to a struct, the field does not exist or cannot be set, or if there is a type mismatch between the field and the value.

func StructFieldNames

func StructFieldNames(s interface{}) []string

StructFieldNames returns a slice of field names for a given struct or a pointer to a struct. If the input is not a struct or a pointer to a struct, it returns an empty slice.

func StructToStringMap

func StructToStringMap(s interface{}) map[string]string

StructToStringMap converts a struct into a map with field names as keys and field values as strings. It supports nested pointers by dereferencing them and handles nil pointers, assigning "<nil>" as their value. The input must be a struct or a pointer to a struct; otherwise, behavior is undefined.

func ToValuers

func ToValuers[T driver.Valuer](in []T) []driver.Valuer

ToValuers converts a slice of types implementing driver.Valuer into a slice of driver.Valuer. Useful for building slices for parameterized queries (e.g., WHERE IN (...)).

func ValidateJWT

func ValidateJWT(tokenString string, secretKey []byte) (*jwt.Token, error)

ValidateJWT validates a JWT using the provided token string and secret key, returning the parsed token if successful or an error if validation fails.

func ZeroStructFieldByName

func ZeroStructFieldByName(ptr interface{}, fieldName string) error

ZeroStructFieldByName sets the specified field of a struct to its zero value. The `ptr` parameter must be a pointer to a struct, and `fieldName` is the name of the field to reset. Returns an error if the field does not exist, cannot be set, or `ptr` is not a pointer to a struct.

Types

type AnyChan

type AnyChan chan any

AnyChan is a typed channel for values of any type.

type AnyMap

type AnyMap map[string]any

AnyMap is a shorthand for a map of string keys to arbitrary values (alias similar to StrAny).

type Anys

type Anys []any

Anys is a shorthand for a slice of values of any type.

type Callback

type Callback func(any) error

Callback is a function that receives a value and may return an error.

type DbDSNConfig

type DbDSNConfig struct {
	Server   string
	Port     int
	Name     string
	User     string
	Password string
	SSLMode  bool
	TimeZone string
}

DbDSNConfig contains the fields used to construct a database DSN string. Fields map to host, port, database name, user, password, SSL mode and timezone.

type ErrChan

type ErrChan chan error

ErrChan is a typed channel for errors.

type Floats

type Floats []float64

Floats is a shorthand for a slice of float64s.

type Handler

type Handler func() error

Handler is a function that returns an error; handy for composing small tasks.

type IntMap

type IntMap map[string]int

IntMap is a shorthand for a map of string keys to int values.

type Ints

type Ints []int

Ints is a shorthand for a slice of ints.

type JSON

type JSON map[string]any

JSON is a convenience alias for a generic JSON object represented as a map.

type Mapper

type Mapper[T any, R any] func(T) R

Mapper maps a value of type T to a value of type R.

type Predicate

type Predicate[T any] func(T) bool

Predicate is a generic function that returns true/false for a value of type T.

type StrAny

type StrAny map[string]any

StrAny is a shorthand for a map of string keys to arbitrary values.

type StrChan

type StrChan chan string

StrChan is a typed channel for strings.

type StrMap

type StrMap map[string]string

StrMap is a shorthand for a map of string keys to string values.

type Strs

type Strs []string

Strs is a shorthand for a slice of strings.

Directories

Path Synopsis
Package ginutils provides helpers for extracting and decoding JWTs from gin.Context.
Package ginutils provides helpers for extracting and decoding JWTs from gin.Context.

Jump to

Keyboard shortcuts

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