Documentation
¶
Index ¶
- Variables
- func CopyMigration(file string, pathToRoot string) error
- func EmptyTransfer[Agr any, Dpd any, Nd Keyed, In any](aggregate Agr, _ Dpd, _ In) (Agr, Nd, error)
- func GetIn(executer gorp.SqlExecutor, records interface{}, ...) ([]interface{}, error)
- func GetMax(executer gorp.SqlExecutor, records interface{}, maxColName string, ...) (int, error)
- func GetPaging(executer gorp.SqlExecutor, records interface{}, ...) ([]interface{}, error)
- func Migrate(db *sql.DB, pathToRoot string) error
- func Mutate[R any](executer gorp.SqlExecutor, dels []R, upds []R, inss []R) error
- func Select[R any](executer gorp.SqlExecutor, query *goqu.SelectDataset) ([]R, error)
- func SelectSingle[R any](executer gorp.SqlExecutor, table string, keys map[string]string, query string, ...) (*R, error)
- type DBAccess
- type Executor
- type GenerateNumber
- type Keyed
- type MutationList
- type ORP
- func (orp *ORP) Begin() error
- func (orp *ORP) Close() error
- func (orp *ORP) Commit() error
- func (o *ORP) GetIn(records interface{}, conditions map[string][]interface{}, forLock bool) ([]interface{}, error)
- func (o *ORP) GetMax(records interface{}, maxColName string, conditions map[string]interface{}) (int, error)
- func (o *ORP) GetPaging(records interface{}, conditions map[string]interface{}, orders []Order, ...) ([]interface{}, error)
- func (orp *ORP) InsideTransaction() bool
- func (orp *ORP) Rollback() error
- type ORPer
- type Order
- type Replace
- type Transactional
- type TransactionalDatabase
- type Transfer
- type TransferWithId
- type TransferWithIdAndNumber
- type Transferable
- type TransferableList
- type TransferableRootAndMulti
- type TransferableRootAndSub
- type TransferableWithId
- type TransferableWithIdAndNumber
Constants ¶
This section is empty.
Variables ¶
View Source
var Dialect = goqu.Dialect("postgres")
Functions ¶
func CopyMigration ¶
func EmptyTransfer ¶
func GetIn ¶
func GetIn(executer gorp.SqlExecutor, records interface{}, conditions map[string][]interface{}, forLock bool) ([]interface{}, error)
func Mutate ¶
func Mutate[R any](executer gorp.SqlExecutor, dels []R, upds []R, inss []R) error
* 集約中のリスト構造をまとめてDBに反映させる
func Select ¶
func Select[R any](executer gorp.SqlExecutor, query *goqu.SelectDataset) ([]R, error)
func SelectSingle ¶
func SelectSingle[R any](executer gorp.SqlExecutor, table string, keys map[string]string, query string, args ...interface{}) (*R, error)
* gorpのSelectOneは、レコードが見つからない場合にエラーになっちゃうがnilで返したいのでSelectSingleを作成
Types ¶
type DBAccess ¶
type DBAccess struct {
Name string `env:"DB_NAME,notEmpty"`
Host string `env:"DB_HOST,notEmpty"`
Port uint `env:"DB_PORT,notEmpty"`
User string `env:"DB_USER,notEmpty"`
Pass string `env:"DB_PASSWORD,notEmpty"`
}
func NewDBAccess ¶
type Executor ¶
type Executor interface {
gorp.SqlExecutor
GetIn(records interface{}, conditions map[string][]interface{}, forLock bool) ([]interface{}, error)
GetMax(records interface{}, maxColName string, conditions map[string]interface{}) (int, error)
GetPaging(records interface{}, conditions map[string]interface{}, orders []Order, pager basic.Pager) ([]interface{}, error)
}
type GenerateNumber ¶
type GenerateNumber[Dpd any] func(gorp.SqlExecutor, Dpd) (uint, error)
type MutationList ¶
type MutationList[Nd any] struct { Dels []Nd Upds []Nd Inss []Nd }
func EmptyReplace ¶
func (MutationList[Nd]) Merge ¶
func (ml MutationList[Nd]) Merge(additional MutationList[Nd]) MutationList[Nd]
type ORP ¶
type ORP struct {
gorp.SqlExecutor
// contains filtered or unexported fields
}
dbMapはtransactionを開始した際に、退避するためのフィールドなので、transactionが開始されていない場合はnil。
func (*ORP) InsideTransaction ¶
type ORPer ¶
type ORPer interface {
TransactionalDatabase
Executor
}
type Transactional ¶
type TransactionalDatabase ¶
type TransactionalDatabase interface {
Transactional
basic.Closable
}
type TransferWithId ¶
type TransferWithIdAndNumber ¶
type Transferable ¶
type TransferableList ¶
type TransferableList[Agr any, Dpd any, Nd any] interface { TransferList(Agr, Dpd) (Agr, MutationList[Nd], error) }
type TransferableRootAndSub ¶
type TransferableWithId ¶
Click to show internal directories.
Click to hide internal directories.