oracle

package
v0.0.0-...-de94dfd Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package oracle contains generated code for schema 'booktest'.

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 SayHello

func SayHello(ctx context.Context, db DB, name string) (string, error)

SayHello calls the stored function 'booktest.say_hello(nvarchar2) nvarchar2' on db.

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 Author

type Author struct {
	AuthorID int    `json:"author_id"` // author_id
	Name     string `json:"name"`      // name
	// contains filtered or unexported fields
}

Author represents a row from 'booktest.authors'.

func AuthorByAuthorID

func AuthorByAuthorID(ctx context.Context, db DB, authorID int) (*Author, error)

AuthorByAuthorID retrieves a row from 'booktest.authors' as a Author.

Generated from index 'authors_pkey'.

func AuthorsByName

func AuthorsByName(ctx context.Context, db DB, name string) ([]*Author, error)

AuthorsByName retrieves a row from 'booktest.authors' as a Author.

Generated from index 'authors_name_idx'.

func (*Author) Delete

func (a *Author) Delete(ctx context.Context, db DB) error

Delete deletes the Author from the database.

func (*Author) Deleted

func (a *Author) Deleted() bool

Deleted returns true when the Author has been marked for deletion from the database.

func (*Author) Exists

func (a *Author) Exists() bool

Exists returns true when the Author exists in the database.

func (*Author) Insert

func (a *Author) Insert(ctx context.Context, db DB) error

Insert inserts the Author to the database.

func (*Author) Save

func (a *Author) Save(ctx context.Context, db DB) error

Save saves the Author to the database.

func (*Author) Update

func (a *Author) Update(ctx context.Context, db DB) error

Update updates a Author in the database.

func (*Author) Upsert

func (a *Author) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Author.

type AuthorBookResult

type AuthorBookResult struct {
	AuthorID   int    `json:"author_id"`   // author_id
	AuthorName string `json:"author_name"` // author_name
	BookID     int    `json:"book_id"`     // book_id
	BookISBN   string `json:"book_isbn"`   // book_isbn
	BookTitle  string `json:"book_title"`  // book_title
	BookTags   string `json:"book_tags"`   // book_tags
}

AuthorBookResult is the result of a search.

func AuthorBookResultsByTags

func AuthorBookResultsByTags(ctx context.Context, db DB, tags string) ([]*AuthorBookResult, error)

AuthorBookResultsByTags runs a custom query, returning results as AuthorBookResult.

type Book

type Book struct {
	BookID      int            `json:"book_id"`     // book_id
	AuthorID    int            `json:"author_id"`   // author_id
	ISBN        string         `json:"isbn"`        // isbn
	Title       string         `json:"title"`       // title
	Year        int            `json:"year"`        // year
	Available   time.Time      `json:"available"`   // available
	Description sql.NullString `json:"description"` // description
	Tags        string         `json:"tags"`        // tags
	// contains filtered or unexported fields
}

Book represents a row from 'booktest.books'.

func BookByBookID

func BookByBookID(ctx context.Context, db DB, bookID int) (*Book, error)

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

Generated from index 'books_pkey'.

func BookByISBN

func BookByISBN(ctx context.Context, db DB, isbn string) (*Book, error)

BookByISBN retrieves a row from 'booktest.books' as a Book.

Generated from index 'books_isbn_key'.

func BooksByTitleYear

func BooksByTitleYear(ctx context.Context, db DB, title string, year int) ([]*Book, error)

BooksByTitleYear retrieves a row from 'booktest.books' as a Book.

Generated from index 'books_title_idx'.

func (*Book) Author

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

Author returns the Author associated with the Book's (AuthorID).

Generated from foreign key 'books_author_id_fkey'.

func (*Book) Delete

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

Delete deletes the Book from the database.

func (*Book) Deleted

func (b *Book) Deleted() bool

Deleted returns true when the Book has been marked for deletion from the database.

func (*Book) Exists

func (b *Book) Exists() bool

Exists returns true when the Book exists in the database.

func (*Book) Insert

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

Insert inserts the Book to the database.

func (*Book) Save

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

Save saves the Book to the database.

func (*Book) Update

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

Update updates a Book in the database.

func (*Book) Upsert

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

Upsert performs an upsert for Book.

type DB

type DB interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

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

This works with both database/sql.DB and database/sql.Tx.

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 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.

Jump to

Keyboard shortcuts

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