mysql

package
v0.0.0-...-d98c8e0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Find
	QueryFindQuestions = `SELECT id, no, question, answer FROM questions`

	// Insert
	QueryInsertQuestion = `INSERT INTO questions (no, question, answer) VALUES (:no, :question, :answer)`

	// Update
	QueryUpdateQuestion = `UPDATE questions SET no=:no, question=:question, answer=:answer WHERE no=:no`

	// delete
	QueryDeleteQuestion = `DELETE FROM questions WHERE no=:no`
)

Variables

View Source
var QuizMasterDB *sqlx.DB

Functions

func InitCon

func InitCon()

func InitMigration

func InitMigration()

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) CreateOrUpdate

func (c *Client) CreateOrUpdate(ctx context.Context, db *sqlx.DB, data interface{}, query string) (lastId int64, err error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, db *sqlx.DB, data interface{}, query *util.Query, queryString string) (err error)

func (*Client) Select

func (c *Client) Select(ctx context.Context, db *sqlx.DB, data *[]entity.Question, query *util.Query, queryString string) (err error)

type IMysql

type IMysql interface {
	Get(context.Context, *sqlx.DB, interface{}, *util.Query, string) error
	Select(context.Context, *sqlx.DB, *[]entity.Question, *util.Query, string) error
	CreateOrUpdate(ctx context.Context, db *sqlx.DB, data interface{}, query string) (lastId int64, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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