entities

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package entities contains generated code for schema 'point_app'.

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

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

type DeleteUser

type DeleteUser struct {
	ID                   uint64    `json:"id" db:"id"`                                         // ユーザーの識別子
	NotificationLatestID uint64    `json:"notification_latest_id" db:"notification_latest_id"` // 最新のお知らせID
	FamilyName           string    `json:"family_name" db:"family_name"`                       // 苗字
	FamilyNameKana       string    `json:"family_name_kana" db:"family_name_kana"`             // 苗字カナ
	FirstName            string    `json:"first_name" db:"first_name"`                         // 名前
	FirstNameKana        string    `json:"first_name_kana" db:"first_name_kana"`               // 名前カナ
	Email                string    `json:"email" db:"email"`                                   // メールアドレス
	Password             string    `json:"password" db:"password"`                             // パスワードハッシュ
	SendingPoint         int       `json:"sending_point" db:"sending_point"`                   // 送信可能ポイント
	CreatedAt            time.Time `json:"created_at" db:"created_at"`                         // レコード作成日時
	UpdateAt             time.Time `json:"update_at" db:"update_at"`                           // レコード修正日時
	DeleteAt             time.Time `json:"delete_at" db:"delete_at"`                           // レコード削除日時
	// contains filtered or unexported fields
}

DeleteUser represents a row from 'point_app.delete_users'.

func DeleteUserByEmail

func DeleteUserByEmail(ctx context.Context, db DB, email string) (*DeleteUser, error)

DeleteUserByEmail retrieves a row from 'point_app.delete_users' as a DeleteUser.

Generated from index 'uix_email'.

func DeleteUserByID

func DeleteUserByID(ctx context.Context, db DB, id uint64) (*DeleteUser, error)

DeleteUserByID retrieves a row from 'point_app.delete_users' as a DeleteUser.

Generated from index 'delete_users_id_pkey'.

func (*DeleteUser) Delete

func (du *DeleteUser) Delete(ctx context.Context, db DB) error

Delete deletes the DeleteUser from the database.

func (*DeleteUser) Deleted

func (du *DeleteUser) Deleted() bool

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

func (*DeleteUser) Exists

func (du *DeleteUser) Exists() bool

Exists returns true when the DeleteUser exists in the database.

func (*DeleteUser) Insert

func (du *DeleteUser) Insert(ctx context.Context, db DB) error

Insert inserts the DeleteUser to the database.

func (*DeleteUser) Save

func (du *DeleteUser) Save(ctx context.Context, db DB) error

Save saves the DeleteUser to the database.

func (*DeleteUser) Update

func (du *DeleteUser) Update(ctx context.Context, db DB) error

Update updates a DeleteUser in the database.

func (*DeleteUser) Upsert

func (du *DeleteUser) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for DeleteUser.

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.

type Notification

type Notification struct {
	ID                 uint64    `json:"id" db:"id"`                                     // お知らせID
	ToUserID           uint64    `json:"to_user_id" db:"to_user_id"`                     // お知らせ先ユーザID
	FromUserID         uint64    `json:"from_user_id" db:"from_user_id"`                 // お知らせ元ユーザID
	IsChecked          bool      `json:"is_checked" db:"is_checked"`                     // チェックフラグ
	NotificationTypeID uint64    `json:"notification_type_id" db:"notification_type_id"` // お知らせ種別ID
	Description        string    `json:"description" db:"description"`                   // 説明
	CreatedAt          time.Time `json:"created_at" db:"created_at"`                     // 作成日時
	// contains filtered or unexported fields
}

Notification represents a row from 'point_app.notifications'.

func NotificationByID

func NotificationByID(ctx context.Context, db DB, id uint64) (*Notification, error)

NotificationByID retrieves a row from 'point_app.notifications' as a Notification.

Generated from index 'notifications_id_pkey'.

func NotificationsByNotificationTypeID

func NotificationsByNotificationTypeID(ctx context.Context, db DB, notificationTypeID uint64) ([]*Notification, error)

NotificationsByNotificationTypeID retrieves a row from 'point_app.notifications' as a Notification.

Generated from index 'fk_notification_type_id'.

func NotificationsByToUserIDID

func NotificationsByToUserIDID(ctx context.Context, db DB, toUserID, id uint64) ([]*Notification, error)

NotificationsByToUserIDID retrieves a row from 'point_app.notifications' as a Notification.

Generated from index 'idx_to_user_id'.

func (*Notification) Delete

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

Delete deletes the Notification from the database.

func (*Notification) Deleted

func (n *Notification) Deleted() bool

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

func (*Notification) Exists

func (n *Notification) Exists() bool

Exists returns true when the Notification exists in the database.

func (*Notification) Insert

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

Insert inserts the Notification to the database.

func (*Notification) NotificationType

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

NotificationType returns the NotificationType associated with the Notification's (NotificationTypeID).

Generated from foreign key 'fk_notification_type_id'.

func (*Notification) Save

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

Save saves the Notification to the database.

func (*Notification) Update

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

Update updates a Notification in the database.

func (*Notification) Upsert

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

Upsert performs an upsert for Notification.

type NotificationType

type NotificationType struct {
	ID    uint64 `json:"id" db:"id"`       // お知らせ種別ID
	Title string `json:"title" db:"title"` // タイトル
	// contains filtered or unexported fields
}

NotificationType represents a row from 'point_app.notification_types'.

func NotificationTypeByID

func NotificationTypeByID(ctx context.Context, db DB, id uint64) (*NotificationType, error)

NotificationTypeByID retrieves a row from 'point_app.notification_types' as a NotificationType.

Generated from index 'notification_types_id_pkey'.

func (*NotificationType) Delete

func (nt *NotificationType) Delete(ctx context.Context, db DB) error

Delete deletes the NotificationType from the database.

func (*NotificationType) Deleted

func (nt *NotificationType) Deleted() bool

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

func (*NotificationType) Exists

func (nt *NotificationType) Exists() bool

Exists returns true when the NotificationType exists in the database.

func (*NotificationType) Insert

func (nt *NotificationType) Insert(ctx context.Context, db DB) error

Insert inserts the NotificationType to the database.

func (*NotificationType) Save

func (nt *NotificationType) Save(ctx context.Context, db DB) error

Save saves the NotificationType to the database.

func (*NotificationType) Update

func (nt *NotificationType) Update(ctx context.Context, db DB) error

Update updates a NotificationType in the database.

func (*NotificationType) Upsert

func (nt *NotificationType) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for NotificationType.

type Transaction

type Transaction struct {
	ID               uint64    `json:"id" db:"id"`                               // 取引の識別子
	SendingUserID    uint64    `json:"sending_user_id" db:"sending_user_id"`     // 送信ユーザのID
	ReceivingUserID  uint64    `json:"receiving_user_id" db:"receiving_user_id"` // 受信ユーザのID
	TransactionPoint int       `json:"transaction_point" db:"transaction_point"` // 取引ポイント
	TransactionAt    time.Time `json:"transaction_at" db:"transaction_at"`       // 取引日時
	// contains filtered or unexported fields
}

Transaction represents a row from 'point_app.transactions'.

func TransactionByID

func TransactionByID(ctx context.Context, db DB, id uint64) (*Transaction, error)

TransactionByID retrieves a row from 'point_app.transactions' as a Transaction.

Generated from index 'transactions_id_pkey'.

func (*Transaction) Delete

func (t *Transaction) Delete(ctx context.Context, db DB) error

Delete deletes the Transaction from the database.

func (*Transaction) Deleted

func (t *Transaction) Deleted() bool

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

func (*Transaction) Exists

func (t *Transaction) Exists() bool

Exists returns true when the Transaction exists in the database.

func (*Transaction) Insert

func (t *Transaction) Insert(ctx context.Context, db DB) error

Insert inserts the Transaction to the database.

func (*Transaction) Save

func (t *Transaction) Save(ctx context.Context, db DB) error

Save saves the Transaction to the database.

func (*Transaction) Update

func (t *Transaction) Update(ctx context.Context, db DB) error

Update updates a Transaction in the database.

func (*Transaction) Upsert

func (t *Transaction) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Transaction.

type User

type User struct {
	ID             int64     `json:"id" db:"id"`                             // ユーザーの識別子
	FamilyName     string    `json:"family_name" db:"family_name"`           // 苗字
	FamilyNameKana string    `json:"family_name_kana" db:"family_name_kana"` // 苗字カナ
	FirstName      string    `json:"first_name" db:"first_name"`             // 名前
	FirstNameKana  string    `json:"first_name_kana" db:"first_name_kana"`   // 名前カナ
	Email          string    `json:"email" db:"email"`                       // メールアドレス
	Password       string    `json:"password" db:"password"`                 // パスワードハッシュ
	SendingPoint   int       `json:"sending_point" db:"sending_point"`       // 送信可能ポイント
	CreatedAt      time.Time `json:"created_at" db:"created_at"`             // レコード作成日時
	UpdateAt       time.Time `json:"update_at" db:"update_at"`               // レコード修正日時
	// contains filtered or unexported fields
}

User represents a row from 'point_app.users'.

func UserByEmail

func UserByEmail(ctx context.Context, db DB, email string) (*User, error)

UserByEmail retrieves a row from 'point_app.users' as a User.

Generated from index 'uix_email'.

func UserByID

func UserByID(ctx context.Context, db DB, id int64) (*User, error)

UserByID retrieves a row from 'point_app.users' as a User.

Generated from index 'users_id_pkey'.

func (*User) Delete

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

Delete deletes the User from the database.

func (*User) Deleted

func (u *User) Deleted() bool

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

func (*User) Exists

func (u *User) Exists() bool

Exists returns true when the User exists in the database.

func (*User) Insert

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

Insert inserts the User to the database.

func (*User) Save

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

Save saves the User to the database.

func (*User) Update

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

Update updates a User in the database.

func (*User) Upsert

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

Upsert performs an upsert for User.

Jump to

Keyboard shortcuts

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