-
Notifications
You must be signed in to change notification settings - Fork 0
[FEATURE] CRUD for knownTx entity #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8b8c0bb
FEAT (#404) : add internalize action to wallet examples (#437)
cain4chain e38d3a9
FEAT (#404) : add internalize action to wallet examples (#437)
cain4chain 38b04df
FEAT (#404) : add internalize action to wallet examples (#437)
cain4chain 4550311
feat: WalletServices: create NLockTimeIsFinal method
ac4ch 2111e9d
feat: WalletServices: create HashOutputScript method
ac4ch 538bf3a
feat: CRUD for knownTx entity only attempts
ac4ch f83a827
feat: CRUD for knownTx entity rest fields
ac4ch ef46dae
Merge branch 'main' into feat/crud_for_knownTx_enity_part2
ac4ch be3a9ad
suggestion: crud filtering - handle enum types (#511)
chris-4chain 272022e
Merge branch 'main' into feat/crud_for_knownTx_enity_part2
ac4ch 94858d0
Merge branch 'main' into feat/crud_for_knownTx_enity_part2
ac4ch 7de3486
Merge branch 'main' into feat/crud_for_knownTx_enity_part2
ac4ch e41b646
Merge branch 'main' into feat/crud_for_knownTx_enity_part2
ac4ch fc635d3
Merge branch 'main' into feat/crud_for_knownTx_enity_part2
ac4ch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package crud | ||
|
||
import "github.com/bsv-blockchain/go-wallet-toolbox/pkg/entity" | ||
|
||
// BoolCondition defines comparison operations for boolean values. | ||
// It enables method chaining for query filters involving bool fields. | ||
type BoolCondition[Parent any] interface { | ||
Equals(value bool) Parent | ||
NotEquals(value bool) Parent | ||
In(value ...bool) Parent | ||
NotIn(value ...bool) Parent | ||
} | ||
|
||
type boolCondition[Parent any] struct { | ||
parent Parent | ||
conditionSetter func(spec *entity.Comparable[bool]) | ||
} | ||
|
||
func (c *boolCondition[Parent]) Equals(value bool) Parent { | ||
c.conditionSetter(&entity.Comparable[bool]{ | ||
Value: value, | ||
Cmp: entity.Equal, | ||
}) | ||
return c.parent | ||
} | ||
|
||
func (c *boolCondition[Parent]) NotEquals(value bool) Parent { | ||
c.conditionSetter(&entity.Comparable[bool]{ | ||
Value: value, | ||
Cmp: entity.NotEqual, | ||
}) | ||
return c.parent | ||
} | ||
|
||
func (c *boolCondition[Parent]) In(values ...bool) Parent { | ||
c.conditionSetter(&entity.Comparable[bool]{ | ||
InValues: values, | ||
Cmp: entity.In, | ||
}) | ||
return c.parent | ||
} | ||
|
||
func (c *boolCondition[Parent]) NotIn(values ...bool) Parent { | ||
c.conditionSetter(&entity.Comparable[bool]{ | ||
InValues: values, | ||
Cmp: entity.NotIn, | ||
}) | ||
return c.parent | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package crud | ||
|
||
import "github.com/bsv-blockchain/go-wallet-toolbox/pkg/entity" | ||
|
||
// StringEnumCondition defines composable filter operations for string-based enum fields in query building. | ||
// It provides equality, inequality and pattern-matching methods that return the Parent type for fluent chainability. | ||
// Methods enable use of equals, not-equals, like, not-like, in, and not-in filters for enum-typed columns. | ||
type StringEnumCondition[Parent any, EnumType ~string] interface { | ||
Equals(value EnumType) Parent | ||
NotEquals(value EnumType) Parent | ||
Like(value EnumType) Parent | ||
NotLike(value EnumType) Parent | ||
In(value ...EnumType) Parent | ||
NotIn(value ...EnumType) Parent | ||
} | ||
|
||
type stringEnumCondition[Parent any, EnumType ~string] struct { | ||
parent Parent | ||
conditionSetter func(spec *entity.Comparable[EnumType]) | ||
} | ||
|
||
func (c *stringEnumCondition[Parent, EnumType]) Equals(value EnumType) Parent { | ||
c.conditionSetter(&entity.Comparable[EnumType]{ | ||
Value: value, | ||
Cmp: entity.Equal, | ||
}) | ||
|
||
return c.parent | ||
} | ||
|
||
func (c *stringEnumCondition[Parent, EnumType]) NotEquals(value EnumType) Parent { | ||
c.conditionSetter(&entity.Comparable[EnumType]{ | ||
Value: value, | ||
Cmp: entity.NotEqual, | ||
}) | ||
|
||
return c.parent | ||
} | ||
|
||
func (c *stringEnumCondition[Parent, EnumType]) Like(value EnumType) Parent { | ||
c.conditionSetter(&entity.Comparable[EnumType]{ | ||
Value: value, | ||
Cmp: entity.Like, | ||
}) | ||
|
||
return c.parent | ||
} | ||
|
||
func (c *stringEnumCondition[Parent, EnumType]) NotLike(value EnumType) Parent { | ||
c.conditionSetter(&entity.Comparable[EnumType]{ | ||
Value: value, | ||
Cmp: entity.NotLike, | ||
}) | ||
|
||
return c.parent | ||
} | ||
|
||
func (c *stringEnumCondition[Parent, EnumType]) In(value ...EnumType) Parent { | ||
c.conditionSetter(&entity.Comparable[EnumType]{ | ||
InValues: value, | ||
Cmp: entity.In, | ||
}) | ||
|
||
return c.parent | ||
} | ||
|
||
func (c *stringEnumCondition[Parent, EnumType]) NotIn(values ...EnumType) Parent { | ||
c.conditionSetter(&entity.Comparable[EnumType]{ | ||
InValues: values, | ||
Cmp: entity.NotIn, | ||
}) | ||
|
||
return c.parent | ||
} |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.