database

package
v0.0.0-...-7efc56f Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderByAsc  int = iota // 昇順
	OrderByDesc            // 降順
)

ソート順

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	DB *gorm.DB
}

Client - DB操作用のクライアント構造体

func NewClient

func NewClient(params *Params) (*Client, error)

NewClient - DBクライアントの構造体

func (*Client) Begin

func (c *Client) Begin(opts ...*sql.TxOptions) (*gorm.DB, error)

func (*Client) Close

func (c *Client) Close(tx *gorm.DB) func()

func (*Client) GetListCount

func (c *Client) GetListCount(table string, db *gorm.DB, q *ListQuery) (int, error)

検索クエリの作成用

func (*Client) GetListQuery

func (c *Client) GetListQuery(table string, db *gorm.DB, q *ListQuery) *gorm.DB

一覧取得クエリの作成用

type ConditionQuery

type ConditionQuery struct {
	Field    string
	Operator string // ==, !=, >、>=, <=, <, IN, LIKE, BETWEEN
	Value    interface{}
}

ConditionQuery - 絞り込み用の構造体

type ListQuery

type ListQuery struct {
	Limit      int
	Offset     int
	Order      *OrderQuery
	Conditions []*ConditionQuery
}

ListQuery - 一覧取得時のクエリ用構造体

type OrderQuery

type OrderQuery struct {
	Field   string
	OrderBy int
}

OrderQuery - ソートクエリ用の構造体

type Params

type Params struct {
	Socket        string
	Host          string
	Port          string
	Database      string
	Username      string
	Password      string
	DisableLogger bool
}

Jump to

Keyboard shortcuts

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