Help us shape the future of Go! Take the 2026 Go Developer Survey

gearcompare

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 1 Imported by: 0

README

gearcompare

Score charging and audio gear against a stated use case rather than a spec sheet — so the winner changes with the question, as it should.

Install

go get github.com/taysirco/gearcompare

Usage

import "github.com/taysirco/gearcompare"

compact := gearcompare.PowerBank{Name: "20000mAh compact", RatedMAh: 20000, OutputWatts: 30, WeightGrams: 350, Ports: 2}
large   := gearcompare.PowerBank{Name: "25000mAh travel",  RatedMAh: 25000, OutputWatts: 100, WeightGrams: 600, Ports: 3}

gearcompare.BetterPowerBank(compact, large, gearcompare.EverydayCarry)  // the compact one
gearcompare.BetterPowerBank(compact, large, gearcompare.Travel)         // the large one

flagship := gearcompare.Earbuds{Name: "flagship", ANCDepthDB: 38, HoursANCOn: 7, HasTransparency: true, Multipoint: true}
budget   := gearcompare.Earbuds{Name: "budget", ANCDepthDB: 22, HoursANCOn: 11, HasTransparency: true, Multipoint: true}

gearcompare.BetterEarbuds(flagship, budget, gearcompare.Commute)  // flagship — deeper cancellation
gearcompare.BetterEarbuds(flagship, budget, gearcompare.Office)   // budget — longer battery

Why the same pair of products swaps places

Spec-sheet comparison has one winner because it rewards the largest number. Real fit does not work that way:

The weightings are explicit in the source so you can disagree with them and change them — which is the point.

License

MIT

Documentation

Overview

Package gearcompare scores charging and audio gear against a stated use case rather than against a spec sheet, so the winner changes with the question.

Spec-sheet comparison rewards the largest numbers. Use-case comparison asks what the numbers are for: a pack that wins on capacity loses on everyday carry, and earbuds that win on cancellation depth lose on battery life.

The reference figures below are drawn from published product specifications; see the package documentation for source pages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BetterEarbuds

func BetterEarbuds(a, b Earbuds, u UseCase) string

BetterEarbuds returns the set that fits the use case better.

func BetterPowerBank

func BetterPowerBank(a, b PowerBank, u UseCase) string

BetterPowerBank returns the pack that fits the use case better.

func ScoreEarbuds

func ScoreEarbuds(e Earbuds, u UseCase) float64

ScoreEarbuds rates a set out of 100 for a use case.

Commute rewards cancellation depth; office rewards endurance and awareness.

func ScorePowerBank

func ScorePowerBank(p PowerBank, u UseCase) float64

ScorePowerBank rates a pack out of 100 for a use case.

Everyday carry penalises weight heavily; travel rewards capacity and ports.

Types

type Earbuds

type Earbuds struct {
	Name            string
	ANCDepthDB      float64
	HoursANCOn      float64
	HasTransparency bool
	Multipoint      bool
}

Earbuds is a set described by the attributes that decide real fit.

Reference data: https://cairovolt.com/en/soundcore/audio/soundcore-liberty-4-nc and https://cairovolt.com/en/soundcore/audio/anker-soundcore-r50i-nc

type PowerBank

type PowerBank struct {
	Name        string
	RatedMAh    float64
	OutputWatts float64
	WeightGrams float64
	Ports       int
}

PowerBank is a pack described by the attributes that decide real fit.

Reference data: https://cairovolt.com/en/anker/power-banks/anker-zolo-a110e-20000 and https://cairovolt.com/en/anker/power-banks/anker-prime-a1695-25000

type UseCase

type UseCase int

UseCase is the pattern the gear will actually serve.

const (
	// EverydayCarry favours weight and bulk over raw capacity.
	EverydayCarry UseCase = iota
	// Travel favours capacity and multi-device support.
	Travel
	// Commute favours cancellation of steady transit noise.
	Commute
	// Office favours battery life and transparency over deep cancellation.
	Office
)

func (UseCase) String

func (u UseCase) String() string

Jump to

Keyboard shortcuts

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