Skip to content

Conversation

@Serjlee
Copy link
Contributor

@Serjlee Serjlee commented Aug 1, 2025

Copilot wrote a more detailed README (thx), but in short:

    1. Comment the struct you are using for the payload:
    // db:filter
    // db:filter import "fmt"
    // db:filter sortField Sort
    type TestStruct struct {
        Sortable
        // db:filter "stuff"
        Test string `query:"test"`
        // db:filter fmt.Sprintf("heee")
        Test2 *string `query:"test2"`
        // db:filter "EEEI"
        Test3 []string `query:"test3"`
    }
    1. Run generate command:
    go run github.com/top-solution/go-libs/v2/dbutils/ops/gen/cmd@v9.9.9 bob <path> # or "boiler"
    1. Enjoy generated methods:
    func (t *TestStruct) AddFilters(q *[]bob.Mod[*dialect.SelectQuery]) error {
    ...
    func (t *TestStruct) AddSorting(query *[]bob.Mod[*dialect.SelectQuery]) error {

@Serjlee Serjlee requested a review from Tydragon00 August 1, 2025 06:40
@Serjlee Serjlee linked an issue Aug 1, 2025 that may be closed by this pull request
@Serjlee Serjlee merged commit c0f2802 into master Aug 13, 2025
1 check passed
@Serjlee Serjlee deleted the magic-filters branch August 13, 2025 15:19
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.

Smarter filters

3 participants