Skip to content

v2.2.0: Model interface cleanup#10

Merged
mkenney merged 8 commits into
mainfrom
v2.1.1-dev
May 23, 2026
Merged

v2.2.0: Model interface cleanup#10
mkenney merged 8 commits into
mainfrom
v2.1.1-dev

Conversation

@mkenney
Copy link
Copy Markdown
Member

@mkenney mkenney commented May 22, 2026

Added

  • model.Model.GetData() — returns snapshots of the data set and key/index maps; implementations must not expose internal storage directly
  • model.Model.Reverse() — reverses the order of the data store
  • sorter.SortByValue — zero-value SortFlag; type-stratified sort (nil < bool < numeric < string < other); now the default sort behavior
  • sorter.SortAsc, SortDesc, SortAsString, SortReverse — explicit bitflag sort options
  • .gitignore

Changed

  • model.ModelTypeHash / model.ModelTypeList renamed to model.HASH / model.LIST; order swapped so HASH is the zero/iota value
  • model.Model.Filter callback signature changed from func(Value) Model to func(Value) bool
  • model.Model.Map callback signature changed from func(Value) Model to func(Value) Value
  • model.Model.Reduce callback signature changed from func(Value) bool to func(carry, cur Value) Value (standard fold semantics)
  • model.Model.SetID now returns error
  • sorter.SortFlag underlying type changed from int to uint
  • sorter.Sorter.Reverse signature changed from Reverse(SortFlag) error to Reverse() error

Fixed

  • errors/error.go package declaration corrected from package error to package errors

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the model and sorter package interfaces/flags as part of a “model interface cleanup”, and adds a repository .gitignore.

Changes:

  • Converted sorter.SortFlag to a bitmask-style flag set and adjusted the Sorter interface (notably Reverse() signature).
  • Updated model.Model API (Filter/Map/Reduce signatures, added GetData() and Reverse(), and changed SetID to return an error).
  • Added a root .gitignore.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 6 comments.

File Description
sorter/sorter.go Switches SortFlag to bit flags and updates the Sorter interface.
model/model.go Renames/reorders ModelType constants and revises the Model interface methods/contracts.
.gitignore Introduces ignore rules for Go/workspace artifacts and local tooling outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sorter/sorter.go Outdated
Comment thread model/model.go
Comment thread model/model.go Outdated
Comment thread model/model.go
Comment thread model/model.go Outdated
Comment thread model/model.go
mkenney and others added 5 commits May 22, 2026 23:57
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bdlm/std/sessions/7b912a44-cd8b-4ba6-897c-b5791ceb555c

Co-authored-by: mkenney <477514+mkenney@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bdlm/std/sessions/7b912a44-cd8b-4ba6-897c-b5791ceb555c

Co-authored-by: mkenney <477514+mkenney@users.noreply.github.com>
@mkenney mkenney changed the title v2.1.1: Model interface cleanup v2.2.0: Model interface cleanup May 23, 2026
Copilot AI review requested due to automatic review settings May 23, 2026 10:06
@mkenney mkenney merged commit e0be382 into main May 23, 2026
1 check failed
@mkenney mkenney deleted the v2.1.1-dev branch May 23, 2026 10:07
@mkenney mkenney review requested due to automatic review settings May 23, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants