got

package
v0.0.0-...-5905bd6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(s string, v ...interface{})

Errorf logs an error message using the package error logger.

func Logf

func Logf(s string, v ...interface{})

Logf logs a message using the package logger.

func SetErrorLogger

func SetErrorLogger(logger interface{})

SetErrorLogger sets the package error logger. Valid logger types:

io.Writer
func(string, ...interface{}) (int, error) // fmt.Printf
func(string, ...interface{}) // log.Printf

func SetLogger

func SetLogger(logger interface{})

SetLogger sets the package logger. Valid logger types:

io.Writer
func(string, ...interface{}) (int, error) // fmt.Printf
func(string, ...interface{}) // log.Printf

Types

type Book

type Book struct {
	BookID BookID `json:"bookID" db:"book_id" required:"true" nullable:"false"` // book_id
	Name   string `json:"name" db:"name" required:"true" nullable:"false"`      // name

	BookAuthorsJoin     *[]User__BA_Book   `json:"-" db:"book_authors_authors" openapi-go:"ignore"`               // M2M book_authors
	BookAuthorsJoinBASK *[]User__BASK_Book `json:"-" db:"book_authors_surrogate_key_authors" openapi-go:"ignore"` // M2M book_authors_surrogate_key
	BookBookReviewsJoin *[]BookReview      `json:"-" db:"book_reviews" openapi-go:"ignore"`                       // M2O books
	BookSellersJoin     *[]User            `json:"-" db:"book_sellers_sellers" openapi-go:"ignore"`               // M2M book_sellers
}

Book represents a row from 'xo_tests.books'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func BookByBookID

func BookByBookID(ctx context.Context, db DB, bookID BookID, opts ...BookSelectConfigOption) (*Book, error)

BookByBookID retrieves a row from 'xo_tests.books' as a Book.

Generated from index 'books_pkey'.

func BookPaginatedByBookIDAsc

func BookPaginatedByBookIDAsc(ctx context.Context, db DB, bookID BookID, opts ...BookSelectConfigOption) ([]Book, error)

BookPaginatedByBookIDAsc returns a cursor-paginated list of Book in Asc order.

func BookPaginatedByBookIDDesc

func BookPaginatedByBookIDDesc(ctx context.Context, db DB, bookID BookID, opts ...BookSelectConfigOption) ([]Book, error)

BookPaginatedByBookIDDesc returns a cursor-paginated list of Book in Desc order.

func CreateBook

func CreateBook(ctx context.Context, db DB, params *BookCreateParams) (*Book, error)

CreateBook creates a new Book in the database with the given params.

func (*Book) Delete

func (b *Book) Delete(ctx context.Context, db DB) error

Delete deletes the Book from the database.

func (*Book) Insert

func (b *Book) Insert(ctx context.Context, db DB) (*Book, error)

Insert inserts the Book to the database.

func (*Book) SetUpdateParams

func (b *Book) SetUpdateParams(params *BookUpdateParams)

SetUpdateParams updates xo_tests.books struct fields with the specified params.

func (*Book) Update

func (b *Book) Update(ctx context.Context, db DB) (*Book, error)

Update updates a Book in the database.

func (*Book) Upsert

func (b *Book) Upsert(ctx context.Context, db DB, params *BookCreateParams) (*Book, error)

Upsert upserts a Book in the database. Requires appropriate PK(s) to be set beforehand.

type BookAuthor

type BookAuthor struct {
	BookID    BookID  `json:"bookID" db:"book_id" required:"true" nullable:"false"`     // book_id
	AuthorID  UserID  `json:"authorID" db:"author_id" required:"true" nullable:"false"` // author_id
	Pseudonym *string `json:"pseudonym" db:"pseudonym"`                                 // pseudonym

	AuthorBooksJoin *[]Book__BA_BookAuthor `json:"-" db:"book_authors_books" openapi-go:"ignore"`   // M2M book_authors
	BookAuthorsJoin *[]User__BA_BookAuthor `json:"-" db:"book_authors_authors" openapi-go:"ignore"` // M2M book_authors
}

BookAuthor represents a row from 'xo_tests.book_authors'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func BookAuthorByBookIDAuthorID

func BookAuthorByBookIDAuthorID(ctx context.Context, db DB, bookID BookID, authorID UserID, opts ...BookAuthorSelectConfigOption) (*BookAuthor, error)

BookAuthorByBookIDAuthorID retrieves a row from 'xo_tests.book_authors' as a BookAuthor.

Generated from index 'book_authors_pkey'.

func BookAuthorsByAuthorID

func BookAuthorsByAuthorID(ctx context.Context, db DB, authorID UserID, opts ...BookAuthorSelectConfigOption) ([]BookAuthor, error)

BookAuthorsByAuthorID retrieves a row from 'xo_tests.book_authors' as a BookAuthor.

Generated from index 'book_authors_pkey'.

func BookAuthorsByBookID

func BookAuthorsByBookID(ctx context.Context, db DB, bookID BookID, opts ...BookAuthorSelectConfigOption) ([]BookAuthor, error)

BookAuthorsByBookID retrieves a row from 'xo_tests.book_authors' as a BookAuthor.

Generated from index 'book_authors_pkey'.

func CreateBookAuthor

func CreateBookAuthor(ctx context.Context, db DB, params *BookAuthorCreateParams) (*BookAuthor, error)

CreateBookAuthor creates a new BookAuthor in the database with the given params.

func (*BookAuthor) Delete

func (ba *BookAuthor) Delete(ctx context.Context, db DB) error

Delete deletes the BookAuthor from the database.

func (*BookAuthor) FKBook_BookID

func (ba *BookAuthor) FKBook_BookID(ctx context.Context, db DB) (*Book, error)

FKBook_BookID returns the Book associated with the BookAuthor's (BookID).

Generated from foreign key 'book_authors_book_id_fkey'.

func (*BookAuthor) FKUser_AuthorID

func (ba *BookAuthor) FKUser_AuthorID(ctx context.Context, db DB) (*User, error)

FKUser_AuthorID returns the User associated with the BookAuthor's (AuthorID).

Generated from foreign key 'book_authors_author_id_fkey'.

func (*BookAuthor) Insert

func (ba *BookAuthor) Insert(ctx context.Context, db DB) (*BookAuthor, error)

Insert inserts the BookAuthor to the database.

func (*BookAuthor) SetUpdateParams

func (ba *BookAuthor) SetUpdateParams(params *BookAuthorUpdateParams)

SetUpdateParams updates xo_tests.book_authors struct fields with the specified params.

func (*BookAuthor) Update

func (ba *BookAuthor) Update(ctx context.Context, db DB) (*BookAuthor, error)

Update updates a BookAuthor in the database.

func (*BookAuthor) Upsert

func (ba *BookAuthor) Upsert(ctx context.Context, db DB, params *BookAuthorCreateParams) (*BookAuthor, error)

Upsert upserts a BookAuthor in the database. Requires appropriate PK(s) to be set beforehand.

type BookAuthorCreateParams

type BookAuthorCreateParams struct {
	AuthorID  UserID  `json:"authorID" required:"true" nullable:"false"` // author_id
	BookID    BookID  `json:"bookID" required:"true" nullable:"false"`   // book_id
	Pseudonym *string `json:"pseudonym"`                                 // pseudonym
}

BookAuthorCreateParams represents insert params for 'xo_tests.book_authors'.

type BookAuthorJoins

type BookAuthorJoins struct {
	BooksAuthor bool // M2M book_authors
	AuthorsBook bool // M2M book_authors
}

type BookAuthorOrderBy

type BookAuthorOrderBy string

type BookAuthorSelectConfig

type BookAuthorSelectConfig struct {
	// contains filtered or unexported fields
}

type BookAuthorSelectConfigOption

type BookAuthorSelectConfigOption func(*BookAuthorSelectConfig)

func WithBookAuthorFilters

func WithBookAuthorFilters(filters map[string][]any) BookAuthorSelectConfigOption

WithBookAuthorFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithBookAuthorJoin

func WithBookAuthorJoin(joins BookAuthorJoins) BookAuthorSelectConfigOption

WithBookAuthorJoin joins with the given tables.

func WithBookAuthorLimit

func WithBookAuthorLimit(limit int) BookAuthorSelectConfigOption

WithBookAuthorLimit limits row selection.

type BookAuthorUpdateParams

type BookAuthorUpdateParams struct {
	AuthorID  *UserID  `json:"authorID" nullable:"false"` // author_id
	BookID    *BookID  `json:"bookID" nullable:"false"`   // book_id
	Pseudonym **string `json:"pseudonym"`                 // pseudonym
}

BookAuthorUpdateParams represents update params for 'xo_tests.book_authors'.

type BookAuthorsSurrogateKey

type BookAuthorsSurrogateKey struct {
	BookAuthorsSurrogateKeyID BookAuthorsSurrogateKeyID `json:"bookAuthorsSurrogateKeyID" db:"book_authors_surrogate_key_id" required:"true" nullable:"false"` // book_authors_surrogate_key_id
	BookID                    BookID                    `json:"bookID" db:"book_id" required:"true" nullable:"false"`                                          // book_id
	AuthorID                  UserID                    `json:"authorID" db:"author_id" required:"true" nullable:"false"`                                      // author_id
	Pseudonym                 *string                   `json:"pseudonym" db:"pseudonym"`                                                                      // pseudonym

	AuthorBooksJoin *[]Book__BASK_BookAuthorsSurrogateKey `json:"-" db:"book_authors_surrogate_key_books" openapi-go:"ignore"`   // M2M book_authors_surrogate_key
	BookAuthorsJoin *[]User__BASK_BookAuthorsSurrogateKey `json:"-" db:"book_authors_surrogate_key_authors" openapi-go:"ignore"` // M2M book_authors_surrogate_key
}

BookAuthorsSurrogateKey represents a row from 'xo_tests.book_authors_surrogate_key'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func BookAuthorsSurrogateKeyByBookAuthorsSurrogateKeyID

func BookAuthorsSurrogateKeyByBookAuthorsSurrogateKeyID(ctx context.Context, db DB, bookAuthorsSurrogateKeyID BookAuthorsSurrogateKeyID, opts ...BookAuthorsSurrogateKeySelectConfigOption) (*BookAuthorsSurrogateKey, error)

BookAuthorsSurrogateKeyByBookAuthorsSurrogateKeyID retrieves a row from 'xo_tests.book_authors_surrogate_key' as a BookAuthorsSurrogateKey.

Generated from index 'book_authors_surrogate_key_pkey'.

func BookAuthorsSurrogateKeyByBookIDAuthorID

func BookAuthorsSurrogateKeyByBookIDAuthorID(ctx context.Context, db DB, bookID BookID, authorID UserID, opts ...BookAuthorsSurrogateKeySelectConfigOption) (*BookAuthorsSurrogateKey, error)

BookAuthorsSurrogateKeyByBookIDAuthorID retrieves a row from 'xo_tests.book_authors_surrogate_key' as a BookAuthorsSurrogateKey.

Generated from index 'book_authors_surrogate_key_book_id_author_id_key'.

func BookAuthorsSurrogateKeyPaginatedByBookAuthorsSurrogateKeyIDAsc

func BookAuthorsSurrogateKeyPaginatedByBookAuthorsSurrogateKeyIDAsc(ctx context.Context, db DB, bookAuthorsSurrogateKeyID BookAuthorsSurrogateKeyID, opts ...BookAuthorsSurrogateKeySelectConfigOption) ([]BookAuthorsSurrogateKey, error)

BookAuthorsSurrogateKeyPaginatedByBookAuthorsSurrogateKeyIDAsc returns a cursor-paginated list of BookAuthorsSurrogateKey in Asc order.

func BookAuthorsSurrogateKeyPaginatedByBookAuthorsSurrogateKeyIDDesc

func BookAuthorsSurrogateKeyPaginatedByBookAuthorsSurrogateKeyIDDesc(ctx context.Context, db DB, bookAuthorsSurrogateKeyID BookAuthorsSurrogateKeyID, opts ...BookAuthorsSurrogateKeySelectConfigOption) ([]BookAuthorsSurrogateKey, error)

BookAuthorsSurrogateKeyPaginatedByBookAuthorsSurrogateKeyIDDesc returns a cursor-paginated list of BookAuthorsSurrogateKey in Desc order.

func BookAuthorsSurrogateKeysByAuthorID

func BookAuthorsSurrogateKeysByAuthorID(ctx context.Context, db DB, authorID UserID, opts ...BookAuthorsSurrogateKeySelectConfigOption) ([]BookAuthorsSurrogateKey, error)

BookAuthorsSurrogateKeysByAuthorID retrieves a row from 'xo_tests.book_authors_surrogate_key' as a BookAuthorsSurrogateKey.

Generated from index 'book_authors_surrogate_key_book_id_author_id_key'.

func BookAuthorsSurrogateKeysByBookID

func BookAuthorsSurrogateKeysByBookID(ctx context.Context, db DB, bookID BookID, opts ...BookAuthorsSurrogateKeySelectConfigOption) ([]BookAuthorsSurrogateKey, error)

BookAuthorsSurrogateKeysByBookID retrieves a row from 'xo_tests.book_authors_surrogate_key' as a BookAuthorsSurrogateKey.

Generated from index 'book_authors_surrogate_key_book_id_author_id_key'.

func CreateBookAuthorsSurrogateKey

func CreateBookAuthorsSurrogateKey(ctx context.Context, db DB, params *BookAuthorsSurrogateKeyCreateParams) (*BookAuthorsSurrogateKey, error)

CreateBookAuthorsSurrogateKey creates a new BookAuthorsSurrogateKey in the database with the given params.

func (*BookAuthorsSurrogateKey) Delete

func (bask *BookAuthorsSurrogateKey) Delete(ctx context.Context, db DB) error

Delete deletes the BookAuthorsSurrogateKey from the database.

func (*BookAuthorsSurrogateKey) FKBook_BookID

func (bask *BookAuthorsSurrogateKey) FKBook_BookID(ctx context.Context, db DB) (*Book, error)

FKBook_BookID returns the Book associated with the BookAuthorsSurrogateKey's (BookID).

Generated from foreign key 'book_authors_surrogate_key_book_id_fkey'.

func (*BookAuthorsSurrogateKey) FKUser_AuthorID

func (bask *BookAuthorsSurrogateKey) FKUser_AuthorID(ctx context.Context, db DB) (*User, error)

FKUser_AuthorID returns the User associated with the BookAuthorsSurrogateKey's (AuthorID).

Generated from foreign key 'book_authors_surrogate_key_author_id_fkey'.

func (*BookAuthorsSurrogateKey) Insert

Insert inserts the BookAuthorsSurrogateKey to the database.

func (*BookAuthorsSurrogateKey) SetUpdateParams

func (bask *BookAuthorsSurrogateKey) SetUpdateParams(params *BookAuthorsSurrogateKeyUpdateParams)

SetUpdateParams updates xo_tests.book_authors_surrogate_key struct fields with the specified params.

func (*BookAuthorsSurrogateKey) Update

Update updates a BookAuthorsSurrogateKey in the database.

func (*BookAuthorsSurrogateKey) Upsert

Upsert upserts a BookAuthorsSurrogateKey in the database. Requires appropriate PK(s) to be set beforehand.

type BookAuthorsSurrogateKeyCreateParams

type BookAuthorsSurrogateKeyCreateParams struct {
	AuthorID  UserID  `json:"authorID" required:"true" nullable:"false"` // author_id
	BookID    BookID  `json:"bookID" required:"true" nullable:"false"`   // book_id
	Pseudonym *string `json:"pseudonym"`                                 // pseudonym
}

BookAuthorsSurrogateKeyCreateParams represents insert params for 'xo_tests.book_authors_surrogate_key'.

type BookAuthorsSurrogateKeyID

type BookAuthorsSurrogateKeyID int

type BookAuthorsSurrogateKeyJoins

type BookAuthorsSurrogateKeyJoins struct {
	BooksAuthor bool // M2M book_authors_surrogate_key
	AuthorsBook bool // M2M book_authors_surrogate_key
}

type BookAuthorsSurrogateKeyOrderBy

type BookAuthorsSurrogateKeyOrderBy string

type BookAuthorsSurrogateKeySelectConfig

type BookAuthorsSurrogateKeySelectConfig struct {
	// contains filtered or unexported fields
}

type BookAuthorsSurrogateKeySelectConfigOption

type BookAuthorsSurrogateKeySelectConfigOption func(*BookAuthorsSurrogateKeySelectConfig)

func WithBookAuthorsSurrogateKeyFilters

func WithBookAuthorsSurrogateKeyFilters(filters map[string][]any) BookAuthorsSurrogateKeySelectConfigOption

WithBookAuthorsSurrogateKeyFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithBookAuthorsSurrogateKeyJoin

func WithBookAuthorsSurrogateKeyJoin(joins BookAuthorsSurrogateKeyJoins) BookAuthorsSurrogateKeySelectConfigOption

WithBookAuthorsSurrogateKeyJoin joins with the given tables.

func WithBookAuthorsSurrogateKeyLimit

func WithBookAuthorsSurrogateKeyLimit(limit int) BookAuthorsSurrogateKeySelectConfigOption

WithBookAuthorsSurrogateKeyLimit limits row selection.

type BookAuthorsSurrogateKeyUpdateParams

type BookAuthorsSurrogateKeyUpdateParams struct {
	AuthorID  *UserID  `json:"authorID" nullable:"false"` // author_id
	BookID    *BookID  `json:"bookID" nullable:"false"`   // book_id
	Pseudonym **string `json:"pseudonym"`                 // pseudonym
}

BookAuthorsSurrogateKeyUpdateParams represents update params for 'xo_tests.book_authors_surrogate_key'.

type BookCreateParams

type BookCreateParams struct {
	Name string `json:"name" required:"true" nullable:"false"` // name
}

BookCreateParams represents insert params for 'xo_tests.books'.

type BookID

type BookID int

type BookJoins

type BookJoins struct {
	AuthorsBook      bool // M2M book_authors
	AuthorsBookUsers bool // M2M book_authors_surrogate_key
	BookReviews      bool // M2O book_reviews
	Sellers          bool // M2M book_sellers
}

type BookOrderBy

type BookOrderBy string

type BookReview

type BookReview struct {
	BookReviewID BookReviewID `json:"bookReviewID" db:"book_review_id" required:"true" nullable:"false"` // book_review_id
	BookID       BookID       `json:"bookID" db:"book_id" required:"true" nullable:"false"`              // book_id
	Reviewer     UserID       `json:"reviewer" db:"reviewer" required:"true" nullable:"false"`           // reviewer

	BookJoin     *Book `json:"-" db:"book_book_id" openapi-go:"ignore"`  // O2O books (generated from M2O)
	ReviewerJoin *User `json:"-" db:"user_reviewer" openapi-go:"ignore"` // O2O users (generated from M2O)
}

BookReview represents a row from 'xo_tests.book_reviews'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func BookReviewByBookReviewID

func BookReviewByBookReviewID(ctx context.Context, db DB, bookReviewID BookReviewID, opts ...BookReviewSelectConfigOption) (*BookReview, error)

BookReviewByBookReviewID retrieves a row from 'xo_tests.book_reviews' as a BookReview.

Generated from index 'book_reviews_pkey'.

func BookReviewByReviewerBookID

func BookReviewByReviewerBookID(ctx context.Context, db DB, reviewer UserID, bookID BookID, opts ...BookReviewSelectConfigOption) (*BookReview, error)

BookReviewByReviewerBookID retrieves a row from 'xo_tests.book_reviews' as a BookReview.

Generated from index 'book_reviews_reviewer_book_id_key'.

func BookReviewPaginatedByBookIDAsc

func BookReviewPaginatedByBookIDAsc(ctx context.Context, db DB, bookID BookID, opts ...BookReviewSelectConfigOption) ([]BookReview, error)

BookReviewPaginatedByBookIDAsc returns a cursor-paginated list of BookReview in Asc order.

func BookReviewPaginatedByBookIDDesc

func BookReviewPaginatedByBookIDDesc(ctx context.Context, db DB, bookID BookID, opts ...BookReviewSelectConfigOption) ([]BookReview, error)

BookReviewPaginatedByBookIDDesc returns a cursor-paginated list of BookReview in Desc order.

func BookReviewPaginatedByBookReviewIDAsc

func BookReviewPaginatedByBookReviewIDAsc(ctx context.Context, db DB, bookReviewID BookReviewID, opts ...BookReviewSelectConfigOption) ([]BookReview, error)

BookReviewPaginatedByBookReviewIDAsc returns a cursor-paginated list of BookReview in Asc order.

func BookReviewPaginatedByBookReviewIDDesc

func BookReviewPaginatedByBookReviewIDDesc(ctx context.Context, db DB, bookReviewID BookReviewID, opts ...BookReviewSelectConfigOption) ([]BookReview, error)

BookReviewPaginatedByBookReviewIDDesc returns a cursor-paginated list of BookReview in Desc order.

func BookReviewsByBookID

func BookReviewsByBookID(ctx context.Context, db DB, bookID BookID, opts ...BookReviewSelectConfigOption) ([]BookReview, error)

BookReviewsByBookID retrieves a row from 'xo_tests.book_reviews' as a BookReview.

Generated from index 'book_reviews_reviewer_book_id_key'.

func BookReviewsByReviewer

func BookReviewsByReviewer(ctx context.Context, db DB, reviewer UserID, opts ...BookReviewSelectConfigOption) ([]BookReview, error)

BookReviewsByReviewer retrieves a row from 'xo_tests.book_reviews' as a BookReview.

Generated from index 'book_reviews_reviewer_book_id_key'.

func CreateBookReview

func CreateBookReview(ctx context.Context, db DB, params *BookReviewCreateParams) (*BookReview, error)

CreateBookReview creates a new BookReview in the database with the given params.

func (*BookReview) Delete

func (br *BookReview) Delete(ctx context.Context, db DB) error

Delete deletes the BookReview from the database.

func (*BookReview) FKBook_BookID

func (br *BookReview) FKBook_BookID(ctx context.Context, db DB) (*Book, error)

FKBook_BookID returns the Book associated with the BookReview's (BookID).

Generated from foreign key 'book_reviews_book_id_fkey'.

func (*BookReview) FKUser_Reviewer

func (br *BookReview) FKUser_Reviewer(ctx context.Context, db DB) (*User, error)

FKUser_Reviewer returns the User associated with the BookReview's (Reviewer).

Generated from foreign key 'book_reviews_reviewer_fkey'.

func (*BookReview) Insert

func (br *BookReview) Insert(ctx context.Context, db DB) (*BookReview, error)

Insert inserts the BookReview to the database.

func (*BookReview) SetUpdateParams

func (br *BookReview) SetUpdateParams(params *BookReviewUpdateParams)

SetUpdateParams updates xo_tests.book_reviews struct fields with the specified params.

func (*BookReview) Update

func (br *BookReview) Update(ctx context.Context, db DB) (*BookReview, error)

Update updates a BookReview in the database.

func (*BookReview) Upsert

func (br *BookReview) Upsert(ctx context.Context, db DB, params *BookReviewCreateParams) (*BookReview, error)

Upsert upserts a BookReview in the database. Requires appropriate PK(s) to be set beforehand.

type BookReviewCreateParams

type BookReviewCreateParams struct {
	BookID   BookID `json:"bookID" required:"true" nullable:"false"`   // book_id
	Reviewer UserID `json:"reviewer" required:"true" nullable:"false"` // reviewer
}

BookReviewCreateParams represents insert params for 'xo_tests.book_reviews'.

type BookReviewID

type BookReviewID int

type BookReviewJoins

type BookReviewJoins struct {
	Book bool // O2O books
	User bool // O2O users
}

type BookReviewOrderBy

type BookReviewOrderBy string

type BookReviewSelectConfig

type BookReviewSelectConfig struct {
	// contains filtered or unexported fields
}

type BookReviewSelectConfigOption

type BookReviewSelectConfigOption func(*BookReviewSelectConfig)

func WithBookReviewFilters

func WithBookReviewFilters(filters map[string][]any) BookReviewSelectConfigOption

WithBookReviewFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithBookReviewJoin

func WithBookReviewJoin(joins BookReviewJoins) BookReviewSelectConfigOption

WithBookReviewJoin joins with the given tables.

func WithBookReviewLimit

func WithBookReviewLimit(limit int) BookReviewSelectConfigOption

WithBookReviewLimit limits row selection.

type BookReviewUpdateParams

type BookReviewUpdateParams struct {
	BookID   *BookID `json:"bookID" nullable:"false"`   // book_id
	Reviewer *UserID `json:"reviewer" nullable:"false"` // reviewer
}

BookReviewUpdateParams represents update params for 'xo_tests.book_reviews'.

type BookSelectConfig

type BookSelectConfig struct {
	// contains filtered or unexported fields
}

type BookSelectConfigOption

type BookSelectConfigOption func(*BookSelectConfig)

func WithBookFilters

func WithBookFilters(filters map[string][]any) BookSelectConfigOption

WithBookFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithBookJoin

func WithBookJoin(joins BookJoins) BookSelectConfigOption

WithBookJoin joins with the given tables.

func WithBookLimit

func WithBookLimit(limit int) BookSelectConfigOption

WithBookLimit limits row selection.

type BookSeller

type BookSeller struct {
	BookID BookID `json:"bookID" db:"book_id" required:"true" nullable:"false"` // book_id
	Seller UserID `json:"seller" db:"seller" required:"true" nullable:"false"`  // seller

	BookSellersJoin *[]User `json:"-" db:"book_sellers_sellers" openapi-go:"ignore"` // M2M book_sellers
	SellerBooksJoin *[]Book `json:"-" db:"book_sellers_books" openapi-go:"ignore"`   // M2M book_sellers
}

BookSeller represents a row from 'xo_tests.book_sellers'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func BookSellersByBookID

func BookSellersByBookID(ctx context.Context, db DB, bookID BookID, opts ...BookSellerSelectConfigOption) ([]BookSeller, error)

BookSellersByBookID retrieves a row from 'xo_tests.book_sellers' as a BookSeller.

Generated from index 'book_sellers_pkey'.

func BookSellersByBookIDSeller

func BookSellersByBookIDSeller(ctx context.Context, db DB, bookID BookID, seller UserID, opts ...BookSellerSelectConfigOption) ([]BookSeller, error)

BookSellersByBookIDSeller retrieves a row from 'xo_tests.book_sellers' as a BookSeller.

Generated from index 'book_sellers_book_id_seller_idx'.

func BookSellersBySeller

func BookSellersBySeller(ctx context.Context, db DB, seller UserID, opts ...BookSellerSelectConfigOption) ([]BookSeller, error)

BookSellersBySeller retrieves a row from 'xo_tests.book_sellers' as a BookSeller.

Generated from index 'book_sellers_pkey'.

func BookSellersBySellerBookID

func BookSellersBySellerBookID(ctx context.Context, db DB, seller UserID, bookID BookID, opts ...BookSellerSelectConfigOption) ([]BookSeller, error)

BookSellersBySellerBookID retrieves a row from 'xo_tests.book_sellers' as a BookSeller.

Generated from index 'book_sellers_seller_book_id_idx'.

func CreateBookSeller

func CreateBookSeller(ctx context.Context, db DB, params *BookSellerCreateParams) (*BookSeller, error)

CreateBookSeller creates a new BookSeller in the database with the given params.

func (*BookSeller) Delete

func (bs *BookSeller) Delete(ctx context.Context, db DB) error

Delete deletes the BookSeller from the database.

func (*BookSeller) FKBook_BookID

func (bs *BookSeller) FKBook_BookID(ctx context.Context, db DB) (*Book, error)

FKBook_BookID returns the Book associated with the BookSeller's (BookID).

Generated from foreign key 'book_sellers_book_id_fkey'.

func (*BookSeller) FKUser_Seller

func (bs *BookSeller) FKUser_Seller(ctx context.Context, db DB) (*User, error)

FKUser_Seller returns the User associated with the BookSeller's (Seller).

Generated from foreign key 'book_sellers_seller_fkey'.

func (*BookSeller) Insert

func (bs *BookSeller) Insert(ctx context.Context, db DB) (*BookSeller, error)

Insert inserts the BookSeller to the database.

func (*BookSeller) SetUpdateParams

func (bs *BookSeller) SetUpdateParams(params *BookSellerUpdateParams)

SetUpdateParams updates xo_tests.book_sellers struct fields with the specified params.

type BookSellerCreateParams

type BookSellerCreateParams struct {
	BookID BookID `json:"bookID" required:"true" nullable:"false"` // book_id
	Seller UserID `json:"seller" required:"true" nullable:"false"` // seller
}

BookSellerCreateParams represents insert params for 'xo_tests.book_sellers'.

type BookSellerJoins

type BookSellerJoins struct {
	Sellers     bool // M2M book_sellers
	BooksSeller bool // M2M book_sellers
}

type BookSellerOrderBy

type BookSellerOrderBy string

type BookSellerSelectConfig

type BookSellerSelectConfig struct {
	// contains filtered or unexported fields
}

type BookSellerSelectConfigOption

type BookSellerSelectConfigOption func(*BookSellerSelectConfig)

func WithBookSellerFilters

func WithBookSellerFilters(filters map[string][]any) BookSellerSelectConfigOption

WithBookSellerFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithBookSellerJoin

func WithBookSellerJoin(joins BookSellerJoins) BookSellerSelectConfigOption

WithBookSellerJoin joins with the given tables.

func WithBookSellerLimit

func WithBookSellerLimit(limit int) BookSellerSelectConfigOption

WithBookSellerLimit limits row selection.

type BookSellerUpdateParams

type BookSellerUpdateParams struct {
	BookID *BookID `json:"bookID" nullable:"false"` // book_id
	Seller *UserID `json:"seller" nullable:"false"` // seller
}

BookSellerUpdateParams represents update params for 'xo_tests.book_sellers'.

type BookUpdateParams

type BookUpdateParams struct {
	Name *string `json:"name" nullable:"false"` // name
}

BookUpdateParams represents update params for 'xo_tests.books'.

type Book__BASK_BookAuthorsSurrogateKey

type Book__BASK_BookAuthorsSurrogateKey struct {
	Book      Book    `json:"book" db:"books" required:"true"`
	Pseudonym *string `json:"pseudonym" db:"pseudonym" required:"true" `
}

Book__BASK_BookAuthorsSurrogateKey represents a M2M join against "xo_tests.book_authors_surrogate_key"

type Book__BASK_User

type Book__BASK_User struct {
	Book      Book    `json:"book" db:"books" required:"true"`
	Pseudonym *string `json:"pseudonym" db:"pseudonym" required:"true" `
}

Book__BASK_User represents a M2M join against "xo_tests.book_authors_surrogate_key"

type Book__BA_BookAuthor

type Book__BA_BookAuthor struct {
	Book      Book    `json:"book" db:"books" required:"true"`
	Pseudonym *string `json:"pseudonym" db:"pseudonym" required:"true" `
}

Book__BA_BookAuthor represents a M2M join against "xo_tests.book_authors"

type Book__BA_User

type Book__BA_User struct {
	Book      Book    `json:"book" db:"books" required:"true"`
	Pseudonym *string `json:"pseudonym" db:"pseudonym" required:"true" `
}

Book__BA_User represents a M2M join against "xo_tests.book_authors"

type DB

type DB interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

DB is the common interface for database operations that can be used with types from schema 'xo_tests'.

type DemoWorkItem

type DemoWorkItem struct {
	WorkItemID WorkItemID `json:"workItemID" db:"work_item_id" required:"true" nullable:"false"` // work_item_id
	Checked    bool       `json:"checked" db:"checked" required:"true" nullable:"false"`         // checked

	WorkItemJoin *WorkItem `json:"-" db:"work_item_work_item_id" openapi-go:"ignore"` // O2O work_items (inferred)
}

DemoWorkItem represents a row from 'xo_tests.demo_work_items'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func CreateDemoWorkItem

func CreateDemoWorkItem(ctx context.Context, db DB, params *DemoWorkItemCreateParams) (*DemoWorkItem, error)

CreateDemoWorkItem creates a new DemoWorkItem in the database with the given params.

func DemoWorkItemByWorkItemID

func DemoWorkItemByWorkItemID(ctx context.Context, db DB, workItemID WorkItemID, opts ...DemoWorkItemSelectConfigOption) (*DemoWorkItem, error)

DemoWorkItemByWorkItemID retrieves a row from 'xo_tests.demo_work_items' as a DemoWorkItem.

Generated from index 'demo_work_items_pkey'.

func DemoWorkItemPaginatedByWorkItemIDAsc

func DemoWorkItemPaginatedByWorkItemIDAsc(ctx context.Context, db DB, workItemID WorkItemID, opts ...DemoWorkItemSelectConfigOption) ([]DemoWorkItem, error)

DemoWorkItemPaginatedByWorkItemIDAsc returns a cursor-paginated list of DemoWorkItem in Asc order.

func DemoWorkItemPaginatedByWorkItemIDDesc

func DemoWorkItemPaginatedByWorkItemIDDesc(ctx context.Context, db DB, workItemID WorkItemID, opts ...DemoWorkItemSelectConfigOption) ([]DemoWorkItem, error)

DemoWorkItemPaginatedByWorkItemIDDesc returns a cursor-paginated list of DemoWorkItem in Desc order.

func (*DemoWorkItem) Delete

func (dwi *DemoWorkItem) Delete(ctx context.Context, db DB) error

Delete deletes the DemoWorkItem from the database.

func (*DemoWorkItem) FKWorkItem_WorkItemID

func (dwi *DemoWorkItem) FKWorkItem_WorkItemID(ctx context.Context, db DB) (*WorkItem, error)

FKWorkItem_WorkItemID returns the WorkItem associated with the DemoWorkItem's (WorkItemID).

Generated from foreign key 'demo_work_items_work_item_id_fkey'.

func (*DemoWorkItem) Insert

func (dwi *DemoWorkItem) Insert(ctx context.Context, db DB) (*DemoWorkItem, error)

Insert inserts the DemoWorkItem to the database.

func (*DemoWorkItem) SetUpdateParams

func (dwi *DemoWorkItem) SetUpdateParams(params *DemoWorkItemUpdateParams)

SetUpdateParams updates xo_tests.demo_work_items struct fields with the specified params.

func (*DemoWorkItem) Update

func (dwi *DemoWorkItem) Update(ctx context.Context, db DB) (*DemoWorkItem, error)

Update updates a DemoWorkItem in the database.

func (*DemoWorkItem) Upsert

func (dwi *DemoWorkItem) Upsert(ctx context.Context, db DB, params *DemoWorkItemCreateParams) (*DemoWorkItem, error)

Upsert upserts a DemoWorkItem in the database. Requires appropriate PK(s) to be set beforehand.

type DemoWorkItemCreateParams

type DemoWorkItemCreateParams struct {
	Checked    bool       `json:"checked" required:"true" nullable:"false"` // checked
	WorkItemID WorkItemID `json:"-" required:"true" nullable:"false"`       // work_item_id
}

DemoWorkItemCreateParams represents insert params for 'xo_tests.demo_work_items'.

type DemoWorkItemJoins

type DemoWorkItemJoins struct {
	WorkItem bool // O2O work_items
}

type DemoWorkItemOrderBy

type DemoWorkItemOrderBy string

type DemoWorkItemSelectConfig

type DemoWorkItemSelectConfig struct {
	// contains filtered or unexported fields
}

type DemoWorkItemSelectConfigOption

type DemoWorkItemSelectConfigOption func(*DemoWorkItemSelectConfig)

func WithDemoWorkItemFilters

func WithDemoWorkItemFilters(filters map[string][]any) DemoWorkItemSelectConfigOption

WithDemoWorkItemFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithDemoWorkItemJoin

func WithDemoWorkItemJoin(joins DemoWorkItemJoins) DemoWorkItemSelectConfigOption

WithDemoWorkItemJoin joins with the given tables.

func WithDemoWorkItemLimit

func WithDemoWorkItemLimit(limit int) DemoWorkItemSelectConfigOption

WithDemoWorkItemLimit limits row selection.

type DemoWorkItemUpdateParams

type DemoWorkItemUpdateParams struct {
	Checked *bool `json:"checked" nullable:"false"` // checked
}

DemoWorkItemUpdateParams represents update params for 'xo_tests.demo_work_items'.

type DummyJoin

type DummyJoin struct {
	DummyJoinID DummyJoinID `json:"dummyJoinID" db:"dummy_join_id" required:"true" nullable:"false"` // dummy_join_id
	Name        *string     `json:"name" db:"name"`                                                  // name
}

DummyJoin represents a row from 'xo_tests.dummy_join'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func CreateDummyJoin

func CreateDummyJoin(ctx context.Context, db DB, params *DummyJoinCreateParams) (*DummyJoin, error)

CreateDummyJoin creates a new DummyJoin in the database with the given params.

func DummyJoinByDummyJoinID

func DummyJoinByDummyJoinID(ctx context.Context, db DB, dummyJoinID DummyJoinID, opts ...DummyJoinSelectConfigOption) (*DummyJoin, error)

DummyJoinByDummyJoinID retrieves a row from 'xo_tests.dummy_join' as a DummyJoin.

Generated from index 'dummy_join_pkey'.

func DummyJoinPaginatedByDummyJoinIDAsc

func DummyJoinPaginatedByDummyJoinIDAsc(ctx context.Context, db DB, dummyJoinID DummyJoinID, opts ...DummyJoinSelectConfigOption) ([]DummyJoin, error)

DummyJoinPaginatedByDummyJoinIDAsc returns a cursor-paginated list of DummyJoin in Asc order.

func DummyJoinPaginatedByDummyJoinIDDesc

func DummyJoinPaginatedByDummyJoinIDDesc(ctx context.Context, db DB, dummyJoinID DummyJoinID, opts ...DummyJoinSelectConfigOption) ([]DummyJoin, error)

DummyJoinPaginatedByDummyJoinIDDesc returns a cursor-paginated list of DummyJoin in Desc order.

func (*DummyJoin) Delete

func (dj *DummyJoin) Delete(ctx context.Context, db DB) error

Delete deletes the DummyJoin from the database.

func (*DummyJoin) Insert

func (dj *DummyJoin) Insert(ctx context.Context, db DB) (*DummyJoin, error)

Insert inserts the DummyJoin to the database.

func (*DummyJoin) SetUpdateParams

func (dj *DummyJoin) SetUpdateParams(params *DummyJoinUpdateParams)

SetUpdateParams updates xo_tests.dummy_join struct fields with the specified params.

func (*DummyJoin) Update

func (dj *DummyJoin) Update(ctx context.Context, db DB) (*DummyJoin, error)

Update updates a DummyJoin in the database.

func (*DummyJoin) Upsert

func (dj *DummyJoin) Upsert(ctx context.Context, db DB, params *DummyJoinCreateParams) (*DummyJoin, error)

Upsert upserts a DummyJoin in the database. Requires appropriate PK(s) to be set beforehand.

type DummyJoinCreateParams

type DummyJoinCreateParams struct {
	Name *string `json:"name"` // name
}

DummyJoinCreateParams represents insert params for 'xo_tests.dummy_join'.

type DummyJoinID

type DummyJoinID int

type DummyJoinJoins

type DummyJoinJoins struct{}

type DummyJoinOrderBy

type DummyJoinOrderBy string

type DummyJoinSelectConfig

type DummyJoinSelectConfig struct {
	// contains filtered or unexported fields
}

type DummyJoinSelectConfigOption

type DummyJoinSelectConfigOption func(*DummyJoinSelectConfig)

func WithDummyJoinFilters

func WithDummyJoinFilters(filters map[string][]any) DummyJoinSelectConfigOption

WithDummyJoinFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithDummyJoinJoin

func WithDummyJoinJoin(joins DummyJoinJoins) DummyJoinSelectConfigOption

WithDummyJoinJoin joins with the given tables.

func WithDummyJoinLimit

func WithDummyJoinLimit(limit int) DummyJoinSelectConfigOption

WithDummyJoinLimit limits row selection.

type DummyJoinUpdateParams

type DummyJoinUpdateParams struct {
	Name **string `json:"name"` // name
}

DummyJoinUpdateParams represents update params for 'xo_tests.dummy_join'.

type Entity

type Entity string
const (
	BookEntity                    Entity = "Book"
	BookAuthorEntity              Entity = "BookAuthor"
	BookAuthorsSurrogateKeyEntity Entity = "BookAuthorsSurrogateKey"
	BookReviewEntity              Entity = "BookReview"
	BookSellerEntity              Entity = "BookSeller"
	DemoWorkItemEntity            Entity = "DemoWorkItem"
	DummyJoinEntity               Entity = "DummyJoin"
	NotificationEntity            Entity = "Notification"
	PagElementEntity              Entity = "PagElement"
	UserEntity                    Entity = "User"
	UserAPIKeyEntity              Entity = "UserAPIKey"
	WorkItemEntity                Entity = "WorkItem"
	WorkItemAssignedUserEntity    Entity = "WorkItemAssignedUser"
)

type ErrInsertFailed

type ErrInsertFailed struct {
	Err error
}

ErrInsertFailed is the insert failed error.

func (*ErrInsertFailed) Error

func (err *ErrInsertFailed) Error() string

Error satisfies the error interface.

func (*ErrInsertFailed) Unwrap

func (err *ErrInsertFailed) Unwrap() error

Unwrap satisfies the unwrap interface.

type ErrInvalidWorkItemRole

type ErrInvalidWorkItemRole string

ErrInvalidWorkItemRole is the invalid WorkItemRole error.

func (ErrInvalidWorkItemRole) Error

func (err ErrInvalidWorkItemRole) Error() string

Error satisfies the error interface.

type ErrUpdateFailed

type ErrUpdateFailed struct {
	Err error
}

ErrUpdateFailed is the update failed error.

func (*ErrUpdateFailed) Error

func (err *ErrUpdateFailed) Error() string

Error satisfies the error interface.

func (*ErrUpdateFailed) Unwrap

func (err *ErrUpdateFailed) Unwrap() error

Unwrap satisfies the unwrap interface.

type ErrUpsertFailed

type ErrUpsertFailed struct {
	Err error
}

ErrUpsertFailed is the upsert failed error.

func (*ErrUpsertFailed) Error

func (err *ErrUpsertFailed) Error() string

Error satisfies the error interface.

func (*ErrUpsertFailed) Unwrap

func (err *ErrUpsertFailed) Unwrap() error

Unwrap satisfies the unwrap interface.

type Error

type Error string

Error is an error.

const (
	// ErrAlreadyExists is the already exists error.
	ErrAlreadyExists Error = "already exists"
	// ErrDoesNotExist is the does not exist error.
	ErrDoesNotExist Error = "does not exist"
	// ErrMarkedForDeletion is the marked for deletion error.
	ErrMarkedForDeletion Error = "marked for deletion"
)

Error values.

func (Error) Error

func (err Error) Error() string

Error satisfies the error interface.

type Notification

type Notification struct {
	NotificationID NotificationID `json:"notificationID" db:"notification_id" required:"true" nullable:"false"` // notification_id
	Body           string         `json:"-" db:"body" nullable:"false" pattern:"^[A-Za-z0-9]*$"`                // body
	Sender         UserID         `json:"sender" db:"sender" required:"true" nullable:"false"`                  // sender
	Receiver       *UserID        `json:"receiver" db:"receiver"`                                               // receiver

	ReceiverJoin *User `json:"-" db:"user_receiver" openapi-go:"ignore"` // O2O users (generated from M2O)
	SenderJoin   *User `json:"-" db:"user_sender" openapi-go:"ignore"`   // O2O users (generated from M2O)
}

Notification represents a row from 'xo_tests.notifications'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func CreateNotification

func CreateNotification(ctx context.Context, db DB, params *NotificationCreateParams) (*Notification, error)

CreateNotification creates a new Notification in the database with the given params.

func NotificationByNotificationID

func NotificationByNotificationID(ctx context.Context, db DB, notificationID NotificationID, opts ...NotificationSelectConfigOption) (*Notification, error)

NotificationByNotificationID retrieves a row from 'xo_tests.notifications' as a Notification.

Generated from index 'notifications_pkey'.

func NotificationPaginatedByNotificationIDAsc

func NotificationPaginatedByNotificationIDAsc(ctx context.Context, db DB, notificationID NotificationID, opts ...NotificationSelectConfigOption) ([]Notification, error)

NotificationPaginatedByNotificationIDAsc returns a cursor-paginated list of Notification in Asc order.

func NotificationPaginatedByNotificationIDDesc

func NotificationPaginatedByNotificationIDDesc(ctx context.Context, db DB, notificationID NotificationID, opts ...NotificationSelectConfigOption) ([]Notification, error)

NotificationPaginatedByNotificationIDDesc returns a cursor-paginated list of Notification in Desc order.

func NotificationsBySender

func NotificationsBySender(ctx context.Context, db DB, sender UserID, opts ...NotificationSelectConfigOption) ([]Notification, error)

NotificationsBySender retrieves a row from 'xo_tests.notifications' as a Notification.

Generated from index 'notifications_sender_idx'.

func (*Notification) Delete

func (n *Notification) Delete(ctx context.Context, db DB) error

Delete deletes the Notification from the database.

func (*Notification) FKUser_Receiver

func (n *Notification) FKUser_Receiver(ctx context.Context, db DB) (*User, error)

FKUser_Receiver returns the User associated with the Notification's (Receiver).

Generated from foreign key 'notifications_receiver_fkey'.

func (*Notification) FKUser_Sender

func (n *Notification) FKUser_Sender(ctx context.Context, db DB) (*User, error)

FKUser_Sender returns the User associated with the Notification's (Sender).

Generated from foreign key 'notifications_sender_fkey'.

func (*Notification) Insert

func (n *Notification) Insert(ctx context.Context, db DB) (*Notification, error)

Insert inserts the Notification to the database.

func (*Notification) SetUpdateParams

func (n *Notification) SetUpdateParams(params *NotificationUpdateParams)

SetUpdateParams updates xo_tests.notifications struct fields with the specified params.

func (*Notification) Update

func (n *Notification) Update(ctx context.Context, db DB) (*Notification, error)

Update updates a Notification in the database.

func (*Notification) Upsert

func (n *Notification) Upsert(ctx context.Context, db DB, params *NotificationCreateParams) (*Notification, error)

Upsert upserts a Notification in the database. Requires appropriate PK(s) to be set beforehand.

type NotificationCreateParams

type NotificationCreateParams struct {
	Body     string  `json:"-" nullable:"false" pattern:"^[A-Za-z0-9]*$"` // body
	Receiver *UserID `json:"receiver"`                                    // receiver
	Sender   UserID  `json:"sender" required:"true" nullable:"false"`     // sender
}

NotificationCreateParams represents insert params for 'xo_tests.notifications'.

type NotificationID

type NotificationID int

type NotificationJoins

type NotificationJoins struct {
	UserReceiver bool // O2O users
	UserSender   bool // O2O users
}

type NotificationOrderBy

type NotificationOrderBy string

type NotificationSelectConfig

type NotificationSelectConfig struct {
	// contains filtered or unexported fields
}

type NotificationSelectConfigOption

type NotificationSelectConfigOption func(*NotificationSelectConfig)

func WithNotificationFilters

func WithNotificationFilters(filters map[string][]any) NotificationSelectConfigOption

WithNotificationFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithNotificationJoin

func WithNotificationJoin(joins NotificationJoins) NotificationSelectConfigOption

WithNotificationJoin joins with the given tables.

func WithNotificationLimit

func WithNotificationLimit(limit int) NotificationSelectConfigOption

WithNotificationLimit limits row selection.

type NotificationUpdateParams

type NotificationUpdateParams struct {
	Body     *string  `json:"-" nullable:"false" pattern:"^[A-Za-z0-9]*$"` // body
	Receiver **UserID `json:"receiver"`                                    // receiver
	Sender   *UserID  `json:"sender" nullable:"false"`                     // sender
}

NotificationUpdateParams represents update params for 'xo_tests.notifications'.

type NullWorkItemRole

type NullWorkItemRole struct {
	WorkItemRole WorkItemRole
	// Valid is true if WorkItemRole is not null.
	Valid bool
}

NullWorkItemRole represents a null 'work_item_role' enum for schema 'xo_tests'.

func (*NullWorkItemRole) Scan

func (nwir *NullWorkItemRole) Scan(v interface{}) error

Scan satisfies the sql.Scanner interface.

func (NullWorkItemRole) Value

func (nwir NullWorkItemRole) Value() (driver.Value, error)

Value satisfies the driver.Valuer interface.

type PagElement

type PagElement struct {
	PaginatedElementID PagElementID `json:"paginatedElementID" db:"paginated_element_id" required:"true" nullable:"false"` // paginated_element_id
	Name               string       `json:"name" db:"name" required:"true" nullable:"false"`                               // name
	CreatedAt          time.Time    `json:"createdAt" db:"created_at" required:"true" nullable:"false"`                    // created_at
	Dummy              *DummyJoinID `json:"dummy" db:"dummy"`                                                              // dummy

	DummyJoin *DummyJoin `json:"-" db:"dummy_join_dummy" openapi-go:"ignore"` // O2O dummy_join (inferred)
}

PagElement represents a row from 'xo_tests.pag_element'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func CreatePagElement

func CreatePagElement(ctx context.Context, db DB, params *PagElementCreateParams) (*PagElement, error)

CreatePagElement creates a new PagElement in the database with the given params.

func PagElementByCreatedAt

func PagElementByCreatedAt(ctx context.Context, db DB, createdAt time.Time, opts ...PagElementSelectConfigOption) (*PagElement, error)

PagElementByCreatedAt retrieves a row from 'xo_tests.pag_element' as a PagElement.

Generated from index 'pag_element_created_at_key'.

func PagElementByPaginatedElementID

func PagElementByPaginatedElementID(ctx context.Context, db DB, paginatedElementID PagElementID, opts ...PagElementSelectConfigOption) (*PagElement, error)

PagElementByPaginatedElementID retrieves a row from 'xo_tests.pag_element' as a PagElement.

Generated from index 'pag_element_pkey'.

func PagElementPaginatedByCreatedAtAsc

func PagElementPaginatedByCreatedAtAsc(ctx context.Context, db DB, createdAt time.Time, opts ...PagElementSelectConfigOption) ([]PagElement, error)

PagElementPaginatedByCreatedAtAsc returns a cursor-paginated list of PagElement in Asc order.

func PagElementPaginatedByCreatedAtDesc

func PagElementPaginatedByCreatedAtDesc(ctx context.Context, db DB, createdAt time.Time, opts ...PagElementSelectConfigOption) ([]PagElement, error)

PagElementPaginatedByCreatedAtDesc returns a cursor-paginated list of PagElement in Desc order.

func (*PagElement) Delete

func (pe *PagElement) Delete(ctx context.Context, db DB) error

Delete deletes the PagElement from the database.

func (*PagElement) FKDummyJoin_Dummy

func (pe *PagElement) FKDummyJoin_Dummy(ctx context.Context, db DB) (*DummyJoin, error)

FKDummyJoin_Dummy returns the DummyJoin associated with the PagElement's (Dummy).

Generated from foreign key 'pag_element_dummy_fkey'.

func (*PagElement) Insert

func (pe *PagElement) Insert(ctx context.Context, db DB) (*PagElement, error)

Insert inserts the PagElement to the database.

func (*PagElement) SetUpdateParams

func (pe *PagElement) SetUpdateParams(params *PagElementUpdateParams)

SetUpdateParams updates xo_tests.pag_element struct fields with the specified params.

func (*PagElement) Update

func (pe *PagElement) Update(ctx context.Context, db DB) (*PagElement, error)

Update updates a PagElement in the database.

func (*PagElement) Upsert

func (pe *PagElement) Upsert(ctx context.Context, db DB, params *PagElementCreateParams) (*PagElement, error)

Upsert upserts a PagElement in the database. Requires appropriate PK(s) to be set beforehand.

type PagElementCreateParams

type PagElementCreateParams struct {
	Dummy *DummyJoinID `json:"dummy"`                                 // dummy
	Name  string       `json:"name" required:"true" nullable:"false"` // name
}

PagElementCreateParams represents insert params for 'xo_tests.pag_element'.

type PagElementID

type PagElementID struct {
	uuid.UUID
}

func NewPagElementID

func NewPagElementID(id uuid.UUID) PagElementID

type PagElementJoins

type PagElementJoins struct {
	DummyJoin bool // O2O dummy_join
}

type PagElementOrderBy

type PagElementOrderBy string
const (
	PagElementCreatedAtDescNullsFirst PagElementOrderBy = " created_at DESC NULLS FIRST "
	PagElementCreatedAtDescNullsLast  PagElementOrderBy = " created_at DESC NULLS LAST "
	PagElementCreatedAtAscNullsFirst  PagElementOrderBy = " created_at ASC NULLS FIRST "
	PagElementCreatedAtAscNullsLast   PagElementOrderBy = " created_at ASC NULLS LAST "
)

type PagElementSelectConfig

type PagElementSelectConfig struct {
	// contains filtered or unexported fields
}

type PagElementSelectConfigOption

type PagElementSelectConfigOption func(*PagElementSelectConfig)

func WithPagElementFilters

func WithPagElementFilters(filters map[string][]any) PagElementSelectConfigOption

WithPagElementFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithPagElementJoin

func WithPagElementJoin(joins PagElementJoins) PagElementSelectConfigOption

WithPagElementJoin joins with the given tables.

func WithPagElementLimit

func WithPagElementLimit(limit int) PagElementSelectConfigOption

WithPagElementLimit limits row selection.

func WithPagElementOrderBy

func WithPagElementOrderBy(rows ...PagElementOrderBy) PagElementSelectConfigOption

WithPagElementOrderBy orders results by the given columns.

type PagElementUpdateParams

type PagElementUpdateParams struct {
	Dummy **DummyJoinID `json:"dummy"`                 // dummy
	Name  *string       `json:"name" nullable:"false"` // name
}

PagElementUpdateParams represents update params for 'xo_tests.pag_element'.

type Trigger

type Trigger struct{}

type User

type User struct {
	UserID    UserID        `json:"userID" db:"user_id" required:"true" nullable:"false"`       // user_id
	Name      string        `json:"name" db:"name" required:"true" nullable:"false"`            // name
	APIKeyID  *UserAPIKeyID `json:"apiKeyID" db:"api_key_id"`                                   // api_key_id
	CreatedAt time.Time     `json:"createdAt" db:"created_at" required:"true" nullable:"false"` // created_at
	DeletedAt *time.Time    `json:"deletedAt" db:"deleted_at"`                                  // deleted_at

	AuthorBooksJoin           *[]Book__BA_User       `json:"-" db:"book_authors_books" openapi-go:"ignore"`                 // M2M book_authors
	AuthorBooksJoinBASK       *[]Book__BASK_User     `json:"-" db:"book_authors_surrogate_key_books" openapi-go:"ignore"`   // M2M book_authors_surrogate_key
	ReviewerBookReviewsJoin   *[]BookReview          `json:"-" db:"book_reviews" openapi-go:"ignore"`                       // M2O users
	SellerBooksJoin           *[]Book                `json:"-" db:"book_sellers_books" openapi-go:"ignore"`                 // M2M book_sellers
	ReceiverNotificationsJoin *[]Notification        `json:"-" db:"notifications_receiver" openapi-go:"ignore"`             // M2O users
	SenderNotificationsJoin   *[]Notification        `json:"-" db:"notifications_sender" openapi-go:"ignore"`               // M2O users
	APIKeyJoin                *UserAPIKey            `json:"-" db:"user_api_key_api_key_id" openapi-go:"ignore"`            // O2O user_api_keys (inferred)
	AssignedUserWorkItemsJoin *[]WorkItem__WIAU_User `json:"-" db:"work_item_assigned_user_work_items" openapi-go:"ignore"` // M2M work_item_assigned_user
}

User represents a row from 'xo_tests.users'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func CreateUser

func CreateUser(ctx context.Context, db DB, params *UserCreateParams) (*User, error)

CreateUser creates a new User in the database with the given params.

func UserByCreatedAt

func UserByCreatedAt(ctx context.Context, db DB, createdAt time.Time, opts ...UserSelectConfigOption) (*User, error)

UserByCreatedAt retrieves a row from 'xo_tests.users' as a User.

Generated from index 'users_created_at_key'.

func UserByName

func UserByName(ctx context.Context, db DB, name string, opts ...UserSelectConfigOption) (*User, error)

UserByName retrieves a row from 'xo_tests.users' as a User.

Generated from index 'users_name_key'.

func UserByUserID

func UserByUserID(ctx context.Context, db DB, userID UserID, opts ...UserSelectConfigOption) (*User, error)

UserByUserID retrieves a row from 'xo_tests.users' as a User.

Generated from index 'users_pkey'.

func UserPaginatedByCreatedAtAsc

func UserPaginatedByCreatedAtAsc(ctx context.Context, db DB, createdAt time.Time, opts ...UserSelectConfigOption) ([]User, error)

UserPaginatedByCreatedAtAsc returns a cursor-paginated list of User in Asc order.

func UserPaginatedByCreatedAtDesc

func UserPaginatedByCreatedAtDesc(ctx context.Context, db DB, createdAt time.Time, opts ...UserSelectConfigOption) ([]User, error)

UserPaginatedByCreatedAtDesc returns a cursor-paginated list of User in Desc order.

func (*User) Delete

func (u *User) Delete(ctx context.Context, db DB) error

Delete deletes the User from the database.

func (*User) FKUserAPIKey_APIKeyID

func (u *User) FKUserAPIKey_APIKeyID(ctx context.Context, db DB) (*UserAPIKey, error)

FKUserAPIKey_APIKeyID returns the UserAPIKey associated with the User's (APIKeyID).

Generated from foreign key 'users_api_key_id_fkey'.

func (*User) Insert

func (u *User) Insert(ctx context.Context, db DB) (*User, error)

Insert inserts the User to the database.

func (*User) Restore

func (u *User) Restore(ctx context.Context, db DB) (*User, error)

Restore restores a soft deleted User from the database.

func (*User) SetUpdateParams

func (u *User) SetUpdateParams(params *UserUpdateParams)

SetUpdateParams updates xo_tests.users struct fields with the specified params.

func (*User) SoftDelete

func (u *User) SoftDelete(ctx context.Context, db DB) error

SoftDelete soft deletes the User from the database via 'deleted_at'.

func (*User) Update

func (u *User) Update(ctx context.Context, db DB) (*User, error)

Update updates a User in the database.

func (*User) Upsert

func (u *User) Upsert(ctx context.Context, db DB, params *UserCreateParams) (*User, error)

Upsert upserts a User in the database. Requires appropriate PK(s) to be set beforehand.

type UserAPIKey

type UserAPIKey struct {
	UserAPIKeyID UserAPIKeyID `json:"-" db:"user_api_key_id" nullable:"false"`                    // user_api_key_id
	APIKey       string       `json:"apiKey" db:"api_key" required:"true" nullable:"false"`       // api_key
	ExpiresOn    time.Time    `json:"expiresOn" db:"expires_on" required:"true" nullable:"false"` // expires_on
	UserID       UserID       `json:"userID" db:"user_id" required:"true" nullable:"false"`       // user_id

	UserJoin *User `json:"-" db:"user_user_id" openapi-go:"ignore"` // O2O users (inferred)
}

UserAPIKey represents a row from 'xo_tests.user_api_keys'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func CreateUserAPIKey

func CreateUserAPIKey(ctx context.Context, db DB, params *UserAPIKeyCreateParams) (*UserAPIKey, error)

CreateUserAPIKey creates a new UserAPIKey in the database with the given params.

func UserAPIKeyByAPIKey

func UserAPIKeyByAPIKey(ctx context.Context, db DB, apiKey string, opts ...UserAPIKeySelectConfigOption) (*UserAPIKey, error)

UserAPIKeyByAPIKey retrieves a row from 'xo_tests.user_api_keys' as a UserAPIKey.

Generated from index 'user_api_keys_api_key_key'.

func UserAPIKeyByUserAPIKeyID

func UserAPIKeyByUserAPIKeyID(ctx context.Context, db DB, userAPIKeyID UserAPIKeyID, opts ...UserAPIKeySelectConfigOption) (*UserAPIKey, error)

UserAPIKeyByUserAPIKeyID retrieves a row from 'xo_tests.user_api_keys' as a UserAPIKey.

Generated from index 'user_api_keys_pkey'.

func UserAPIKeyByUserID

func UserAPIKeyByUserID(ctx context.Context, db DB, userID UserID, opts ...UserAPIKeySelectConfigOption) (*UserAPIKey, error)

UserAPIKeyByUserID retrieves a row from 'xo_tests.user_api_keys' as a UserAPIKey.

Generated from index 'user_api_keys_user_id_key'.

func UserAPIKeyPaginatedByUserAPIKeyIDAsc

func UserAPIKeyPaginatedByUserAPIKeyIDAsc(ctx context.Context, db DB, userAPIKeyID UserAPIKeyID, opts ...UserAPIKeySelectConfigOption) ([]UserAPIKey, error)

UserAPIKeyPaginatedByUserAPIKeyIDAsc returns a cursor-paginated list of UserAPIKey in Asc order.

func UserAPIKeyPaginatedByUserAPIKeyIDDesc

func UserAPIKeyPaginatedByUserAPIKeyIDDesc(ctx context.Context, db DB, userAPIKeyID UserAPIKeyID, opts ...UserAPIKeySelectConfigOption) ([]UserAPIKey, error)

UserAPIKeyPaginatedByUserAPIKeyIDDesc returns a cursor-paginated list of UserAPIKey in Desc order.

func (*UserAPIKey) Delete

func (uak *UserAPIKey) Delete(ctx context.Context, db DB) error

Delete deletes the UserAPIKey from the database.

func (*UserAPIKey) FKUser_UserID

func (uak *UserAPIKey) FKUser_UserID(ctx context.Context, db DB) (*User, error)

FKUser_UserID returns the User associated with the UserAPIKey's (UserID).

Generated from foreign key 'user_api_keys_user_id_fkey'.

func (*UserAPIKey) Insert

func (uak *UserAPIKey) Insert(ctx context.Context, db DB) (*UserAPIKey, error)

Insert inserts the UserAPIKey to the database.

func (*UserAPIKey) SetUpdateParams

func (uak *UserAPIKey) SetUpdateParams(params *UserAPIKeyUpdateParams)

SetUpdateParams updates xo_tests.user_api_keys struct fields with the specified params.

func (*UserAPIKey) Update

func (uak *UserAPIKey) Update(ctx context.Context, db DB) (*UserAPIKey, error)

Update updates a UserAPIKey in the database.

func (*UserAPIKey) Upsert

func (uak *UserAPIKey) Upsert(ctx context.Context, db DB, params *UserAPIKeyCreateParams) (*UserAPIKey, error)

Upsert upserts a UserAPIKey in the database. Requires appropriate PK(s) to be set beforehand.

type UserAPIKeyCreateParams

type UserAPIKeyCreateParams struct {
	APIKey    string    `json:"apiKey" required:"true" nullable:"false"`    // api_key
	ExpiresOn time.Time `json:"expiresOn" required:"true" nullable:"false"` // expires_on
	UserID    UserID    `json:"userID" required:"true" nullable:"false"`    // user_id
}

UserAPIKeyCreateParams represents insert params for 'xo_tests.user_api_keys'.

type UserAPIKeyID

type UserAPIKeyID int

type UserAPIKeyJoins

type UserAPIKeyJoins struct {
	User bool // O2O users
}

type UserAPIKeyOrderBy

type UserAPIKeyOrderBy string
const (
	UserAPIKeyExpiresOnDescNullsFirst UserAPIKeyOrderBy = " expires_on DESC NULLS FIRST "
	UserAPIKeyExpiresOnDescNullsLast  UserAPIKeyOrderBy = " expires_on DESC NULLS LAST "
	UserAPIKeyExpiresOnAscNullsFirst  UserAPIKeyOrderBy = " expires_on ASC NULLS FIRST "
	UserAPIKeyExpiresOnAscNullsLast   UserAPIKeyOrderBy = " expires_on ASC NULLS LAST "
)

type UserAPIKeySelectConfig

type UserAPIKeySelectConfig struct {
	// contains filtered or unexported fields
}

type UserAPIKeySelectConfigOption

type UserAPIKeySelectConfigOption func(*UserAPIKeySelectConfig)

func WithUserAPIKeyFilters

func WithUserAPIKeyFilters(filters map[string][]any) UserAPIKeySelectConfigOption

WithUserAPIKeyFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithUserAPIKeyJoin

func WithUserAPIKeyJoin(joins UserAPIKeyJoins) UserAPIKeySelectConfigOption

WithUserAPIKeyJoin joins with the given tables.

func WithUserAPIKeyLimit

func WithUserAPIKeyLimit(limit int) UserAPIKeySelectConfigOption

WithUserAPIKeyLimit limits row selection.

func WithUserAPIKeyOrderBy

func WithUserAPIKeyOrderBy(rows ...UserAPIKeyOrderBy) UserAPIKeySelectConfigOption

WithUserAPIKeyOrderBy orders results by the given columns.

type UserAPIKeyUpdateParams

type UserAPIKeyUpdateParams struct {
	APIKey    *string    `json:"apiKey" nullable:"false"`    // api_key
	ExpiresOn *time.Time `json:"expiresOn" nullable:"false"` // expires_on
	UserID    *UserID    `json:"userID" nullable:"false"`    // user_id
}

UserAPIKeyUpdateParams represents update params for 'xo_tests.user_api_keys'.

type UserCreateParams

type UserCreateParams struct {
	APIKeyID *UserAPIKeyID `json:"apiKeyID"`                              // api_key_id
	Name     string        `json:"name" required:"true" nullable:"false"` // name
}

UserCreateParams represents insert params for 'xo_tests.users'.

type UserID

type UserID struct {
	uuid.UUID
}

func NewUserID

func NewUserID(id uuid.UUID) UserID

type UserJoins

type UserJoins struct {
	BooksAuthor           bool // M2M book_authors
	BooksAuthorBooks      bool // M2M book_authors_surrogate_key
	BookReviews           bool // M2O book_reviews
	BooksSeller           bool // M2M book_sellers
	NotificationsReceiver bool // M2O notifications
	NotificationsSender   bool // M2O notifications
	UserAPIKey            bool // O2O user_api_keys
	WorkItemsAssignedUser bool // M2M work_item_assigned_user
}

type UserOrderBy

type UserOrderBy string
const (
	UserCreatedAtDescNullsFirst UserOrderBy = " created_at DESC NULLS FIRST "
	UserCreatedAtDescNullsLast  UserOrderBy = " created_at DESC NULLS LAST "
	UserCreatedAtAscNullsFirst  UserOrderBy = " created_at ASC NULLS FIRST "
	UserCreatedAtAscNullsLast   UserOrderBy = " created_at ASC NULLS LAST "
	UserDeletedAtDescNullsFirst UserOrderBy = " deleted_at DESC NULLS FIRST "
	UserDeletedAtDescNullsLast  UserOrderBy = " deleted_at DESC NULLS LAST "
	UserDeletedAtAscNullsFirst  UserOrderBy = " deleted_at ASC NULLS FIRST "
	UserDeletedAtAscNullsLast   UserOrderBy = " deleted_at ASC NULLS LAST "
)

type UserSelectConfig

type UserSelectConfig struct {
	// contains filtered or unexported fields
}

type UserSelectConfigOption

type UserSelectConfigOption func(*UserSelectConfig)

func WithDeletedUserOnly

func WithDeletedUserOnly() UserSelectConfigOption

WithDeletedUserOnly limits result to records marked as deleted.

func WithUserFilters

func WithUserFilters(filters map[string][]any) UserSelectConfigOption

WithUserFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithUserJoin

func WithUserJoin(joins UserJoins) UserSelectConfigOption

WithUserJoin joins with the given tables.

func WithUserLimit

func WithUserLimit(limit int) UserSelectConfigOption

WithUserLimit limits row selection.

func WithUserOrderBy

func WithUserOrderBy(rows ...UserOrderBy) UserSelectConfigOption

WithUserOrderBy orders results by the given columns.

type UserUpdateParams

type UserUpdateParams struct {
	APIKeyID **UserAPIKeyID `json:"apiKeyID"`              // api_key_id
	Name     *string        `json:"name" nullable:"false"` // name
}

UserUpdateParams represents update params for 'xo_tests.users'.

type User__BASK_Book

type User__BASK_Book struct {
	User      User    `json:"user" db:"users" required:"true"`
	Pseudonym *string `json:"pseudonym" db:"pseudonym" required:"true" `
}

User__BASK_Book represents a M2M join against "xo_tests.book_authors_surrogate_key"

type User__BASK_BookAuthorsSurrogateKey

type User__BASK_BookAuthorsSurrogateKey struct {
	User      User    `json:"user" db:"users" required:"true"`
	Pseudonym *string `json:"pseudonym" db:"pseudonym" required:"true" `
}

User__BASK_BookAuthorsSurrogateKey represents a M2M join against "xo_tests.book_authors_surrogate_key"

type User__BA_Book

type User__BA_Book struct {
	User      User    `json:"user" db:"users" required:"true"`
	Pseudonym *string `json:"pseudonym" db:"pseudonym" required:"true" `
}

User__BA_Book represents a M2M join against "xo_tests.book_authors"

type User__BA_BookAuthor

type User__BA_BookAuthor struct {
	User      User    `json:"user" db:"users" required:"true"`
	Pseudonym *string `json:"pseudonym" db:"pseudonym" required:"true" `
}

User__BA_BookAuthor represents a M2M join against "xo_tests.book_authors"

type User__WIAU_WorkItem

type User__WIAU_WorkItem struct {
	User User             `json:"user" db:"users" required:"true"`
	Role NullWorkItemRole `json:"role" db:"role" required:"true" `
}

User__WIAU_WorkItem represents a M2M join against "xo_tests.work_item_assigned_user"

type User__WIAU_WorkItemAssignedUser

type User__WIAU_WorkItemAssignedUser struct {
	User User             `json:"user" db:"users" required:"true"`
	Role NullWorkItemRole `json:"role" db:"role" required:"true" `
}

User__WIAU_WorkItemAssignedUser represents a M2M join against "xo_tests.work_item_assigned_user"

type WorkItem

type WorkItem struct {
	WorkItemID  WorkItemID `json:"workItemID" db:"work_item_id" required:"true" nullable:"false"` // work_item_id
	Title       *string    `json:"title" db:"title"`                                              // title
	Description *string    `json:"description" db:"description"`                                  // description

	DemoWorkItemJoin          *DemoWorkItem          `json:"-" db:"demo_work_item_work_item_id" openapi-go:"ignore"`            // O2O demo_work_items (inferred)
	WorkItemAssignedUsersJoin *[]User__WIAU_WorkItem `json:"-" db:"work_item_assigned_user_assigned_users" openapi-go:"ignore"` // M2M work_item_assigned_user
}

WorkItem represents a row from 'xo_tests.work_items'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func CreateWorkItem

func CreateWorkItem(ctx context.Context, db DB, params *WorkItemCreateParams) (*WorkItem, error)

CreateWorkItem creates a new WorkItem in the database with the given params.

func WorkItemByWorkItemID

func WorkItemByWorkItemID(ctx context.Context, db DB, workItemID WorkItemID, opts ...WorkItemSelectConfigOption) (*WorkItem, error)

WorkItemByWorkItemID retrieves a row from 'xo_tests.work_items' as a WorkItem.

Generated from index 'work_items_pkey'.

func WorkItemPaginatedByWorkItemIDAsc

func WorkItemPaginatedByWorkItemIDAsc(ctx context.Context, db DB, workItemID WorkItemID, opts ...WorkItemSelectConfigOption) ([]WorkItem, error)

WorkItemPaginatedByWorkItemIDAsc returns a cursor-paginated list of WorkItem in Asc order.

func WorkItemPaginatedByWorkItemIDDesc

func WorkItemPaginatedByWorkItemIDDesc(ctx context.Context, db DB, workItemID WorkItemID, opts ...WorkItemSelectConfigOption) ([]WorkItem, error)

WorkItemPaginatedByWorkItemIDDesc returns a cursor-paginated list of WorkItem in Desc order.

func WorkItems

func WorkItems(ctx context.Context, db DB, opts ...WorkItemSelectConfigOption) ([]WorkItem, error)

WorkItems retrieves a row from 'xo_tests.work_items' as a WorkItem.

Generated from index '[xo] base filter query'.

func WorkItemsByTitle

func WorkItemsByTitle(ctx context.Context, db DB, title *string, opts ...WorkItemSelectConfigOption) ([]WorkItem, error)

WorkItemsByTitle retrieves a row from 'xo_tests.work_items' as a WorkItem.

Generated from index 'work_items_title_description_idx1'.

func (*WorkItem) Delete

func (wi *WorkItem) Delete(ctx context.Context, db DB) error

Delete deletes the WorkItem from the database.

func (*WorkItem) Insert

func (wi *WorkItem) Insert(ctx context.Context, db DB) (*WorkItem, error)

Insert inserts the WorkItem to the database.

func (*WorkItem) SetUpdateParams

func (wi *WorkItem) SetUpdateParams(params *WorkItemUpdateParams)

SetUpdateParams updates xo_tests.work_items struct fields with the specified params.

func (*WorkItem) Update

func (wi *WorkItem) Update(ctx context.Context, db DB) (*WorkItem, error)

Update updates a WorkItem in the database.

func (*WorkItem) Upsert

func (wi *WorkItem) Upsert(ctx context.Context, db DB, params *WorkItemCreateParams) (*WorkItem, error)

Upsert upserts a WorkItem in the database. Requires appropriate PK(s) to be set beforehand.

type WorkItemAssignedUser

type WorkItemAssignedUser struct {
	WorkItemID   WorkItemID       `json:"workItemID" db:"work_item_id" required:"true" nullable:"false"`    // work_item_id
	AssignedUser UserID           `json:"assignedUser" db:"assigned_user" required:"true" nullable:"false"` // assigned_user
	Role         NullWorkItemRole `json:"role" db:"role" required:"true" nullable:"false"`                  // role

	AssignedUserWorkItemsJoin *[]WorkItem__WIAU_WorkItemAssignedUser `json:"-" db:"work_item_assigned_user_work_items" openapi-go:"ignore"`     // M2M work_item_assigned_user
	WorkItemAssignedUsersJoin *[]User__WIAU_WorkItemAssignedUser     `json:"-" db:"work_item_assigned_user_assigned_users" openapi-go:"ignore"` // M2M work_item_assigned_user
}

WorkItemAssignedUser represents a row from 'xo_tests.work_item_assigned_user'. Change properties via SQL column comments, joined with " && ":

  • "properties":<p1>,<p2>,...
  • private to exclude a field from JSON.
  • not-required to make a schema field not required.
  • "type":<pkg.type> to override the type annotation. An openapi schema named <type> must exist.
  • "cardinality":<O2O|M2O|M2M> to generate/override joins explicitly. Only O2O is inferred.
  • "tags":<tags> to append literal struct tag strings.

func CreateWorkItemAssignedUser

func CreateWorkItemAssignedUser(ctx context.Context, db DB, params *WorkItemAssignedUserCreateParams) (*WorkItemAssignedUser, error)

CreateWorkItemAssignedUser creates a new WorkItemAssignedUser in the database with the given params.

func WorkItemAssignedUserByWorkItemIDAssignedUser

func WorkItemAssignedUserByWorkItemIDAssignedUser(ctx context.Context, db DB, workItemID WorkItemID, assignedUser UserID, opts ...WorkItemAssignedUserSelectConfigOption) (*WorkItemAssignedUser, error)

WorkItemAssignedUserByWorkItemIDAssignedUser retrieves a row from 'xo_tests.work_item_assigned_user' as a WorkItemAssignedUser.

Generated from index 'work_item_assigned_user_pkey'.

func WorkItemAssignedUsersByAssignedUser

func WorkItemAssignedUsersByAssignedUser(ctx context.Context, db DB, assignedUser UserID, opts ...WorkItemAssignedUserSelectConfigOption) ([]WorkItemAssignedUser, error)

WorkItemAssignedUsersByAssignedUser retrieves a row from 'xo_tests.work_item_assigned_user' as a WorkItemAssignedUser.

Generated from index 'work_item_assigned_user_pkey'.

func WorkItemAssignedUsersByAssignedUserWorkItemID

func WorkItemAssignedUsersByAssignedUserWorkItemID(ctx context.Context, db DB, assignedUser UserID, workItemID WorkItemID, opts ...WorkItemAssignedUserSelectConfigOption) ([]WorkItemAssignedUser, error)

WorkItemAssignedUsersByAssignedUserWorkItemID retrieves a row from 'xo_tests.work_item_assigned_user' as a WorkItemAssignedUser.

Generated from index 'work_item_assigned_user_assigned_user_work_item_id_idx'.

func WorkItemAssignedUsersByWorkItemID

func WorkItemAssignedUsersByWorkItemID(ctx context.Context, db DB, workItemID WorkItemID, opts ...WorkItemAssignedUserSelectConfigOption) ([]WorkItemAssignedUser, error)

WorkItemAssignedUsersByWorkItemID retrieves a row from 'xo_tests.work_item_assigned_user' as a WorkItemAssignedUser.

Generated from index 'work_item_assigned_user_pkey'.

func (*WorkItemAssignedUser) Delete

func (wiau *WorkItemAssignedUser) Delete(ctx context.Context, db DB) error

Delete deletes the WorkItemAssignedUser from the database.

func (*WorkItemAssignedUser) FKUser_AssignedUser

func (wiau *WorkItemAssignedUser) FKUser_AssignedUser(ctx context.Context, db DB) (*User, error)

FKUser_AssignedUser returns the User associated with the WorkItemAssignedUser's (AssignedUser).

Generated from foreign key 'work_item_assigned_user_assigned_user_fkey'.

func (*WorkItemAssignedUser) FKWorkItem_WorkItemID

func (wiau *WorkItemAssignedUser) FKWorkItem_WorkItemID(ctx context.Context, db DB) (*WorkItem, error)

FKWorkItem_WorkItemID returns the WorkItem associated with the WorkItemAssignedUser's (WorkItemID).

Generated from foreign key 'work_item_assigned_user_work_item_id_fkey'.

func (*WorkItemAssignedUser) Insert

Insert inserts the WorkItemAssignedUser to the database.

func (*WorkItemAssignedUser) SetUpdateParams

func (wiau *WorkItemAssignedUser) SetUpdateParams(params *WorkItemAssignedUserUpdateParams)

SetUpdateParams updates xo_tests.work_item_assigned_user struct fields with the specified params.

func (*WorkItemAssignedUser) Update

Update updates a WorkItemAssignedUser in the database.

func (*WorkItemAssignedUser) Upsert

Upsert upserts a WorkItemAssignedUser in the database. Requires appropriate PK(s) to be set beforehand.

type WorkItemAssignedUserCreateParams

type WorkItemAssignedUserCreateParams struct {
	AssignedUser UserID           `json:"assignedUser" required:"true" nullable:"false"` // assigned_user
	Role         NullWorkItemRole `json:"role" required:"true" nullable:"false"`         // role
	WorkItemID   WorkItemID       `json:"workItemID" required:"true" nullable:"false"`   // work_item_id
}

WorkItemAssignedUserCreateParams represents insert params for 'xo_tests.work_item_assigned_user'.

type WorkItemAssignedUserJoins

type WorkItemAssignedUserJoins struct {
	WorkItemsAssignedUser bool // M2M work_item_assigned_user
	AssignedUsers         bool // M2M work_item_assigned_user
}

type WorkItemAssignedUserOrderBy

type WorkItemAssignedUserOrderBy string

type WorkItemAssignedUserSelectConfig

type WorkItemAssignedUserSelectConfig struct {
	// contains filtered or unexported fields
}

type WorkItemAssignedUserSelectConfigOption

type WorkItemAssignedUserSelectConfigOption func(*WorkItemAssignedUserSelectConfig)

func WithWorkItemAssignedUserFilters

func WithWorkItemAssignedUserFilters(filters map[string][]any) WorkItemAssignedUserSelectConfigOption

WithWorkItemAssignedUserFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithWorkItemAssignedUserJoin

func WithWorkItemAssignedUserJoin(joins WorkItemAssignedUserJoins) WorkItemAssignedUserSelectConfigOption

WithWorkItemAssignedUserJoin joins with the given tables.

func WithWorkItemAssignedUserLimit

func WithWorkItemAssignedUserLimit(limit int) WorkItemAssignedUserSelectConfigOption

WithWorkItemAssignedUserLimit limits row selection.

type WorkItemAssignedUserUpdateParams

type WorkItemAssignedUserUpdateParams struct {
	AssignedUser *UserID           `json:"assignedUser" nullable:"false"` // assigned_user
	Role         *NullWorkItemRole `json:"role" nullable:"false"`         // role
	WorkItemID   *WorkItemID       `json:"workItemID" nullable:"false"`   // work_item_id
}

WorkItemAssignedUserUpdateParams represents update params for 'xo_tests.work_item_assigned_user'.

type WorkItemCreateParams

type WorkItemCreateParams struct {
	Description *string `json:"description"` // description
	Title       *string `json:"title"`       // title
}

WorkItemCreateParams represents insert params for 'xo_tests.work_items'.

type WorkItemID

type WorkItemID int

type WorkItemJoins

type WorkItemJoins struct {
	DemoWorkItem  bool // O2O demo_work_items
	AssignedUsers bool // M2M work_item_assigned_user
}

type WorkItemOrderBy

type WorkItemOrderBy string

type WorkItemRole

type WorkItemRole string

WorkItemRole is the 'work_item_role' enum type from schema 'xo_tests'.

const (
	// WorkItemRolePreparer is the 'preparer' work_item_role.
	WorkItemRolePreparer WorkItemRole = "preparer"
	// WorkItemRoleReviewer is the 'reviewer' work_item_role.
	WorkItemRoleReviewer WorkItemRole = "reviewer"
)

WorkItemRole values.

func AllWorkItemRoleValues

func AllWorkItemRoleValues() []WorkItemRole

func (*WorkItemRole) Scan

func (wir *WorkItemRole) Scan(src interface{}) error

Scan satisfies the sql.Scanner interface.

func (WorkItemRole) Value

func (wir WorkItemRole) Value() (driver.Value, error)

Value satisfies the driver.Valuer interface.

type WorkItemSelectConfig

type WorkItemSelectConfig struct {
	// contains filtered or unexported fields
}

type WorkItemSelectConfigOption

type WorkItemSelectConfigOption func(*WorkItemSelectConfig)

func WithWorkItemFilters

func WithWorkItemFilters(filters map[string][]any) WorkItemSelectConfigOption

WithWorkItemFilters adds the given filters, which can be dynamically parameterized with $i to prevent SQL injection. Example:

filters := map[string][]any{
	"NOT (col.name = any ($i))": {[]string{"excl_name_1", "excl_name_2"}},
	`(col.created_at > $i OR
	col.is_closed = $i)`: {time.Now().Add(-24 * time.Hour), true},
}

func WithWorkItemJoin

func WithWorkItemJoin(joins WorkItemJoins) WorkItemSelectConfigOption

WithWorkItemJoin joins with the given tables.

func WithWorkItemLimit

func WithWorkItemLimit(limit int) WorkItemSelectConfigOption

WithWorkItemLimit limits row selection.

type WorkItemUpdateParams

type WorkItemUpdateParams struct {
	Description **string `json:"description"` // description
	Title       **string `json:"title"`       // title
}

WorkItemUpdateParams represents update params for 'xo_tests.work_items'.

type WorkItem__WIAU_User

type WorkItem__WIAU_User struct {
	WorkItem WorkItem         `json:"workItem" db:"work_items" required:"true"`
	Role     NullWorkItemRole `json:"role" db:"role" required:"true" `
}

WorkItem__WIAU_User represents a M2M join against "xo_tests.work_item_assigned_user"

type WorkItem__WIAU_WorkItemAssignedUser

type WorkItem__WIAU_WorkItemAssignedUser struct {
	WorkItem WorkItem         `json:"workItem" db:"work_items" required:"true"`
	Role     NullWorkItemRole `json:"role" db:"role" required:"true" `
}

WorkItem__WIAU_WorkItemAssignedUser represents a M2M join against "xo_tests.work_item_assigned_user"

type XoError

type XoError struct {
	Entity string
	Err    error
}

func (*XoError) Error

func (e *XoError) Error() string

Error satisfies the error interface.

func (*XoError) Unwrap

func (err *XoError) Unwrap() error

Unwrap satisfies the unwrap interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL