Skip to content

support for restrictions on maps or structs based on AIP-160 syntax #14

@funcpointer

Description

@funcpointer

Hey folks.. this package is quite neat! Thanks for sharing it.

quick question: The code does not seem like it is able to support maps (like JSONBs) or structs?

type User struct {
	PikaTableName string         `pika:"users"`
	ID            string         `db:"id"`
	Name          string         `db:"name"`
	Age           int32          `db:"age"`
	Active        bool           `db:"active"`
	Score         float64        `db:"score"`
	CreatedAt     time.Time      `db:"created_at"`
	Tags          pq.StringArray `db:"tags"`
	Roles         pq.StringArray `db:"roles"`
	Preferences   []byte         `db:"preferences"`
	Metadata      []byte         `db:"metadata"`
}

the : operator on repeating cases works well. e.g., name = "Bob Smith" AND roles:"admin" works where roles is an array.

For the JSONB case:

e.g.,

		// JSONB filters
		// Check if key exists using JSONB operators
		`metadata:department`, // Check if department key exists

		// Check for specific values using JSONB operators
		`metadata.department:"engineering"`, // Check if department is "engineering"

These filters fail with Error applying filter: unexpected identifier department.

Before I try to dig deeper, is this a known issue? Are there any workarounds?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions