Skip to content

feat: Add Any, All, ContainsAll, ContainsAny, Random, First, Last, and driver.Valuer#25

Merged
freeformz merged 1 commit intomainfrom
ffz/NewFeatures
Feb 16, 2026
Merged

feat: Add Any, All, ContainsAll, ContainsAny, Random, First, Last, and driver.Valuer#25
freeformz merged 1 commit intomainfrom
ffz/NewFeatures

Conversation

@freeformz
Copy link
Owner

Summary

  • Add Any/All predicate functions with short-circuit evaluation
  • Add ContainsAll/ContainsAny variadic convenience functions for membership checks
  • Add Random for non-destructive random element selection (O(1) for ordered sets via At, O(n) for unordered)
  • Add First/Last accessors for OrderedSet
  • Implement driver.Valuer on all 5 set types (Map, SyncMap, Locked, Ordered, LockedOrdered) to complement existing sql.Scanner
  • Update README with new SQL section and all new function documentation

Test plan

  • State machine actions added for Any, All, ContainsAll, ContainsAny, Random, and Valuer — tested across all 5 set types via rapid property-based testing
  • Dedicated TestFirst_Last_Ordered and TestFirst_Last_LockedOrdered tests
  • Example tests for all new functions
  • go test -v -race ./... passes
  • go vet ./... clean
  • staticcheck ./... clean

🤖 Generated with Claude Code

…d driver.Valuer

Add predicate functions (Any/All), variadic membership checks
(ContainsAll/ContainsAny), non-destructive Random element selection
(O(1) for ordered sets, O(n) for unordered), First/Last accessors for
OrderedSet, and driver.Valuer on all set types to complement the
existing sql.Scanner support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

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 adds several utility functions for set operations and implements database integration support across all set types. The changes enhance the API with predicate functions (Any/All), membership checks (ContainsAll/ContainsAny), random element selection, and ordered set accessors (First/Last). Additionally, all five set types now implement driver.Valuer to complement the existing sql.Scanner implementation.

Changes:

  • Added predicate functions Any and All with short-circuit evaluation for testing set elements against conditions
  • Added ContainsAll and ContainsAny variadic functions for convenient membership checks
  • Added Random function for non-destructive random element selection (O(1) for ordered sets, O(n) for unordered)
  • Added First and Last accessor functions for OrderedSet types
  • Implemented driver.Valuer interface on all 5 set types for database/sql integration
  • Updated README with new SQL section and comprehensive documentation of new functions

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
set.go Core implementation of Any, All, ContainsAll, ContainsAny, and Random functions
ordered_set.go Implementation of First and Last accessor functions for ordered sets
map.go Added driver.Valuer implementation for Map set type
sync.go Added driver.Valuer implementation for SyncMap set type
locked.go Added driver.Valuer implementation for Locked set type
ordered.go Added driver.Valuer implementation for Ordered set type
locked_ordered.go Added driver.Valuer implementation for LockedOrdered set type
set_test.go Comprehensive state machine tests for all new functions across all set types
examples_test.go Example tests demonstrating usage of all new functions
README.MD Documentation updates with SQL section and new function descriptions
.gitignore Added .claude/settings.local.json to ignore list

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

@freeformz freeformz merged commit 5e7055a into main Feb 16, 2026
15 checks passed
@freeformz freeformz deleted the ffz/NewFeatures branch February 16, 2026 00:50
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.

1 participant