gorm2

package
v0.0.0-...-4b5a188 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package gorm2 Gorm v2を使ったリポジトリ実装

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSQLDb

func GetSQLDb(repo *Repository) (*sql.DB, error)

GetSQLDb sqlパッケージのDBインスタンスを取得

Types

type Config

type Config struct {
	Hostname string
	Port     int
	Username string
	Password string
	Database string
}

Config Gorm v2リポジトリ用Config

type Repository

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

Repository Gorm v2リポジトリ

func NewGorm2Repository

func NewGorm2Repository(c *Config, logger *zap.Logger) (*Repository, error)

NewGorm2Repository 新しいGorm v2リポジトリを生成

func (*Repository) Do

func (repo *Repository) Do(ctx context.Context, options *sql.TxOptions, callBack func(context.Context) error) error

Do Transactionの中でメソッドを実行する

Jump to

Keyboard shortcuts

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