Repository navigation
refactor!: API hygiene before 1.0 - #93
Merged
Merged
Conversation
- confx: Load takes WithFlags values instead of a pflag set (confx/cliflags.Changed builds them); WithRemoved names keys removed without a replacement; shared doc tags and messages no longer name a product; MovedKeys, ParseTrustedProxy, ValidChannelName and TX.Mutations are gone; Contract.Default is a contract.Policy. - pgexec: SanitizeMessage is gone in favour of Classify; ParseIsolation and ParseDetail reject unknown spellings instead of falling back. - contract: ParsePolicy; View fails on an unknown policy; Apply, OmitAll and TransformCatalog are gone. - postgis: OutputSQL, Derived.SQL and RasterAccessor.SQL take an Output (json, precision) instead of four variants each; Ops, Deriveds and RasterAccessors are accessor functions; Op.Index and Op.Arg are Indexable and OperandType; OpsDoc, OpNames and DerivedSuffixes are gone. - contrib: VectorTypes is an accessor function. - jwtmint: Sign is unexported. - watch: New(Config) validates up front, OnChange receives Run's context, and Run no longer writes into the watcher's fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces PR 90 (auto-closed when its stacked base branch was deleted). Rebased onto main after PR 89.
Closes #87
Stacked on #89 (base
feat/smarttags-v5). Once #89 merges, GitHub retargets this PR tomain, and I'll rebase it onto the squash commit.Implements the readiness review's B15 cleanup. The full list is in
docs/upgrading.md("API hygiene") andCHANGELOG.mdUnreleased.confx
Load(envPrefix, path, dst, opts...)no longer imports pflag. Command-line values come in throughWithFlags(map[path]value), and the newconfx/cliflags.Changed(fs, except...)replacesChangedFlags.WithRemoved(map[old]reason)option for keys removed without a replacement. The error readsunknown key transactions.mutations: removed: <reason>, for both file keys and environment variables.schema.cache_path,auth.headers.prefixanderrors.detaildoc tags no longer name a product, and theInvalidConfigdoc no longer says "pdbq's error shape".MovedKeys,ParseTrustedProxy,ValidChannelNameand the unreadTX.Mutationsfield are no longer exported.Contract.Defaultis acontract.Policy.Typed enums that reject instead of falling back
pgexec.ParseIsolationreturns(pgx.TxIsoLevel, error)andpgexec.ParseDetailreturns(Detail, error);DetailgainsString.transactions.isolationerrors now name the accepted values.contract.ParsePolicyis new, andContract.Viewreturns an error for an unknown policy.One error-policy API
pgexec.SanitizeMessage(pgErr, strict)is gone.Classify(err, detail).Messagerenders the same text.postgis and contrib
OutputSQL(ref, Output{JSON, Precision})replaces the fourOutput{,JSON}{,Precision}SQLfunctions.Derived.SQL(ref, f, Output)andRasterAccessor.SQL(ref, Output)replace their variants.Ops(),Deriveds(),RasterAccessors()andcontrib.VectorTypes()replace the mutable exported variables.postgis.Op.Index/Op.Argare renamed toIndexable/OperandType, so they no longer clash withcontrib.Op.Index/contrib.Op.Arg.Pruned exports
jwtmint.Sign,contract.Apply/OmitAll/TransformCatalog,postgis.OpsDoc/OpNames/DerivedSuffixes.main. An export was pruned only when neither product nor pdbcore's external tests or docs need it.watch
New(Config) (*Watcher, error)validates the names and requiresPoolandOnChange.OnChangeisfunc(ctx, cat)and receivesRun's context.Runno longer writes defaults or state back into the watcher's fields; per-run state lives in an unexported struct.CI
The
downstreamjob builds pdbq and pdbrmainagainst this branch. It is expected to fail here because of the breaking changes, until the pdbq and pdbr PRs that switch to this API merge.Tests
go test -race ./...,go vet,golangci-lintlint-test