Documentation
¶
Overview ¶
Package dao contains generated code for schema 'public'.
Index ¶
- func Errorf(s string, v ...interface{})
- func Logf(s string, v ...interface{})
- func SetErrorLogger(logger interface{})
- func SetLogger(logger interface{})
- type DB
- type ErrDecodeFailed
- type ErrInsertFailed
- type ErrUpdateFailed
- type ErrUpsertFailed
- type Error
- type News
- func (n *News) BulkInsert(ctx context.Context, idb interface{}, rows []News, now time.Time) error
- func (n *News) Delete(ctx context.Context, idb interface{}, now time.Time) error
- func (n *News) Insert(ctx context.Context, idb interface{}, now time.Time) error
- func (n *News) Update(ctx context.Context, idb interface{}, now time.Time) error
- func (n *News) Upsert(ctx context.Context, idb interface{}, now time.Time) error
- type StringSlice
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 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
Types ¶
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 'public'.
This works with both database/sql.DB and database/sql.Tx.
type ErrDecodeFailed ¶
type ErrDecodeFailed struct {
Err error
}
ErrDecodeFailed is the decode failed error.
func (*ErrDecodeFailed) Error ¶
func (err *ErrDecodeFailed) Error() string
Error satisfies the error interface.
func (*ErrDecodeFailed) Unwrap ¶
func (err *ErrDecodeFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
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.
const ErrInvalidStringSlice Error = "invalid StringSlice"
ErrInvalidStringSlice is the invalid StringSlice error.
type News ¶
type News struct { ID int `db:"id"` // id Title string `db:"title"` // title Description string `db:"description"` // description CreatedAt time.Time `db:"created_at"` // created_at UpdatedAt time.Time `db:"updated_at"` // updated_at }
News represents a row from 'public.news'.
func NewsByID ¶
NewsByID retrieves a row from 'public.news' as a News.
Generated from index 'news_pkey'.
func (*News) BulkInsert ¶
BulkInsert inserts the News to the database.
type StringSlice ¶
type StringSlice []string
StringSlice is a slice of strings.
func (*StringSlice) Scan ¶
func (ss *StringSlice) Scan(v interface{}) error
Scan satisfies the sql.Scanner interface for StringSlice.