test_mysql_interface

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Journey

type Journey interface {
	// @Insert()
	AddCustomer(ctx context.Context, c model.Customer) (sql.Result, error)

	// @Insert(				)
	AddTicket(ctx context.Context, t *another_model.Ticket) (sql.Result, error)

	// @Update("UPDATE 		customer SET name = ? WHERE email = ?")
	UpdateCustomerNameByEmail(ctx context.Context, name, email string) (sql.Result, error)

	// @Update("UPDATE customer SET name = ? WHERE id in (?)")
	UpdateCustomerNameByIDList(ctx context.Context, name string, idList []uint64) (sql.Result, error)

	// @Delete("DELETE FROM  customer WHERE 	id   = ?")
	DeleteCustomerByID(ctx context.Context, ID uint64) (sql.Result, error)

	// @Delete("DELETE FROM  customer WHERE 	id   In     (?)")
	DeleteCustomerByIDList(ctx context.Context, IDList []uint64) (sql.Result, error)

	// @Select("SELECT 		* FROM customer WHERE id   = ?")
	GetCustomerByID(ctx context.Context, ID uint64) (model.Customer, error)

	/* @Select(
	"SELECT * FROM ticket WHERE id =  ?"
	)    */
	GetTicketByID(ctx context.Context, ID uint64) (*another_model.Ticket, error)

	/*
	  @Select("SELECT * FROM  ticket WHERE customer_id = ? ORDER BY id DESC LIMIT 10")
	*/
	GetTicketsByCustomerID(ctx context.Context, customerID uint64) ([]*another_model.Ticket, error)

	/* @Select("SELECT * FROM customer
	        WHERE name = ? AND
	email = ? LIMIT ?, ?") */
	GetCustomersByNameAndEmail(ctx context.Context, name, email string, offset, limit uint64) ([]model.Customer, error)

	// @Select("SELECT `email` 		FROM customer 		WHERE name = ? LIMIT 0, 3")
	GetCustomerEmailsByName(ctx context.Context, name string) ([]string, error)

	// @Select("SELECT name FROM `customer` WHERE email = 	? LIMIT 1")
	GetCustomerNameByEmail(ctx context.Context, email string) (string, error)

	// @Select("SELECT *	 FROM ticket WHERE id IN (1,	 2) AND price = 0 limit 1")
	GetFirstFreeTicket(ctx context.Context) (*another_model.Ticket, error)

	// @Select("SELECT * FROM ticket WHERE id IN (?) AND `price` > ? LIMIT 12")
	GetTicketsByIDListAndPrice(ctx context.Context, IDList []uint64, price float64) ([]*another_model.Ticket, error)

	// @Select("SELECT * FROM ticket WHERE tea like :tea AND id IN (:idList) limit :limit")
	GetTicketsLikeTea(ctx context.Context, payload map[string]interface{}) ([]another_model.Ticket, error)

	// @Select("SELECT * FROM ticket WHERE id in (1, 2, 3, 4, 5) limit :customer_id, 2")
	GetTicketsByOffset(ctx context.Context, payload *another_model.Ticket) ([]*another_model.Ticket, error)

	// @Select("SELECT * FROM ticket WHERE `from`=:from limit 2, :customer_id")
	GetTicketsByFrom(ctx context.Context, payload another_model.Ticket) ([]*another_model.Ticket, error)

	// @Select("SELECT * FROM ticket WHERE token!= :order AND id IN (:from) AND price > 0 limit 2, :limit")
	GetTicketWhichTokenIsNotEqualTo(ctx context.Context, payload map[string]interface{}) (*another_model.Ticket, error)

	// @Select("SELECT * FROM ticket WHERE price>:price AND id in (1, 2)")
	GetTicketGreaterThanPrice(ctx context.Context, payload *another_model.Ticket) (another_model.Ticket, error)

	// @Update("Update customer sET member_id= :member_id WHERE id = 1")
	UpdateCustomerMemberIDByID(ctx context.Context, c *model.Customer) (sql.Result, error)

	// @Update("Update customer sET member_id= :member_id WHERE id in (1, 2)")
	UpdateCustomerMemberIDByIDList(ctx context.Context, c *model.Customer) (sql.Result, error)

	// @Delete("Delete FroM customer where email= :email")
	DeleteCustomerByEmail(ctx context.Context, x map[string]interface{}) (sql.Result, error)

	// @Delete("Delete FroM customer where email= :email oR id In (:id_list)")
	DeleteCustomerByEmailOrIDList(ctx context.Context, x map[string]interface{}) (sql.Result, error)
}

type JourneyImpl

type JourneyImpl struct {
	DB *sqlx.DB
}

func NewJourney

func NewJourney(db *sqlx.DB) *JourneyImpl

func (*JourneyImpl) AddCustomer

func (db *JourneyImpl) AddCustomer(ctx context.Context, c model.Customer) (sql.Result, error)

func (*JourneyImpl) AddTicket

func (db *JourneyImpl) AddTicket(ctx context.Context, t *another_model.Ticket) (sql.Result, error)

func (*JourneyImpl) Begin

func (db *JourneyImpl) Begin(ctx context.Context, options *sql.TxOptions) *TxJourneyImpl

func (*JourneyImpl) DeleteCustomerByEmail

func (db *JourneyImpl) DeleteCustomerByEmail(ctx context.Context, x map[string]interface{}) (sql.Result, error)

func (*JourneyImpl) DeleteCustomerByEmailOrIDList

func (db *JourneyImpl) DeleteCustomerByEmailOrIDList(ctx context.Context, x map[string]interface{}) (sql.Result, error)

func (*JourneyImpl) DeleteCustomerByID

func (db *JourneyImpl) DeleteCustomerByID(ctx context.Context, ID uint64) (sql.Result, error)

func (*JourneyImpl) DeleteCustomerByIDList

func (db *JourneyImpl) DeleteCustomerByIDList(ctx context.Context, IDList []uint64) (sql.Result, error)

func (*JourneyImpl) GetCustomerByID

func (db *JourneyImpl) GetCustomerByID(ctx context.Context, ID uint64) (model.Customer, error)

func (*JourneyImpl) GetCustomerEmailsByName

func (db *JourneyImpl) GetCustomerEmailsByName(ctx context.Context, name string) ([]string, error)

func (*JourneyImpl) GetCustomerNameByEmail

func (db *JourneyImpl) GetCustomerNameByEmail(ctx context.Context, email string) (string, error)

func (*JourneyImpl) GetCustomersByNameAndEmail

func (db *JourneyImpl) GetCustomersByNameAndEmail(ctx context.Context, name, email string, offset, limit uint64) ([]model.Customer, error)

func (*JourneyImpl) GetFirstFreeTicket

func (db *JourneyImpl) GetFirstFreeTicket(ctx context.Context) (*another_model.Ticket, error)

func (*JourneyImpl) GetTicketByID

func (db *JourneyImpl) GetTicketByID(ctx context.Context, ID uint64) (*another_model.Ticket, error)

func (*JourneyImpl) GetTicketGreaterThanPrice

func (db *JourneyImpl) GetTicketGreaterThanPrice(ctx context.Context, payload *another_model.Ticket) (another_model.Ticket, error)

func (*JourneyImpl) GetTicketWhichTokenIsNotEqualTo

func (db *JourneyImpl) GetTicketWhichTokenIsNotEqualTo(ctx context.Context, payload map[string]interface{}) (*another_model.Ticket, error)

func (*JourneyImpl) GetTicketsByCustomerID

func (db *JourneyImpl) GetTicketsByCustomerID(ctx context.Context, customerID uint64) ([]*another_model.Ticket, error)

func (*JourneyImpl) GetTicketsByFrom

func (db *JourneyImpl) GetTicketsByFrom(ctx context.Context, payload another_model.Ticket) ([]*another_model.Ticket, error)

func (*JourneyImpl) GetTicketsByIDListAndPrice

func (db *JourneyImpl) GetTicketsByIDListAndPrice(ctx context.Context, IDList []uint64, price float64) ([]*another_model.Ticket, error)

func (*JourneyImpl) GetTicketsByOffset

func (db *JourneyImpl) GetTicketsByOffset(ctx context.Context, payload *another_model.Ticket) ([]*another_model.Ticket, error)

func (*JourneyImpl) GetTicketsLikeTea

func (db *JourneyImpl) GetTicketsLikeTea(ctx context.Context, payload map[string]interface{}) ([]another_model.Ticket, error)

func (*JourneyImpl) UpdateCustomerMemberIDByID

func (db *JourneyImpl) UpdateCustomerMemberIDByID(ctx context.Context, c *model.Customer) (sql.Result, error)

func (*JourneyImpl) UpdateCustomerMemberIDByIDList

func (db *JourneyImpl) UpdateCustomerMemberIDByIDList(ctx context.Context, c *model.Customer) (sql.Result, error)

func (*JourneyImpl) UpdateCustomerNameByEmail

func (db *JourneyImpl) UpdateCustomerNameByEmail(ctx context.Context, name, email string) (sql.Result, error)

func (*JourneyImpl) UpdateCustomerNameByIDList

func (db *JourneyImpl) UpdateCustomerNameByIDList(ctx context.Context, name string, idList []uint64) (sql.Result, error)

type TxJourneyImpl

type TxJourneyImpl struct {
	TX *sqlx.Tx
}

func (*TxJourneyImpl) AddCustomer

func (tx *TxJourneyImpl) AddCustomer(ctx context.Context, c model.Customer) (sql.Result, error)

func (*TxJourneyImpl) AddTicket

func (tx *TxJourneyImpl) AddTicket(ctx context.Context, t *another_model.Ticket) (sql.Result, error)

func (*TxJourneyImpl) Commit

func (tx *TxJourneyImpl) Commit(ctx context.Context) error

func (*TxJourneyImpl) DeleteCustomerByEmail

func (tx *TxJourneyImpl) DeleteCustomerByEmail(ctx context.Context, x map[string]interface{}) (sql.Result, error)

func (*TxJourneyImpl) DeleteCustomerByEmailOrIDList

func (tx *TxJourneyImpl) DeleteCustomerByEmailOrIDList(ctx context.Context, x map[string]interface{}) (sql.Result, error)

func (*TxJourneyImpl) DeleteCustomerByID

func (tx *TxJourneyImpl) DeleteCustomerByID(ctx context.Context, ID uint64) (sql.Result, error)

func (*TxJourneyImpl) DeleteCustomerByIDList

func (tx *TxJourneyImpl) DeleteCustomerByIDList(ctx context.Context, IDList []uint64) (sql.Result, error)

func (*TxJourneyImpl) GetCustomerByID

func (tx *TxJourneyImpl) GetCustomerByID(ctx context.Context, ID uint64) (model.Customer, error)

func (*TxJourneyImpl) GetCustomerEmailsByName

func (tx *TxJourneyImpl) GetCustomerEmailsByName(ctx context.Context, name string) ([]string, error)

func (*TxJourneyImpl) GetCustomerNameByEmail

func (tx *TxJourneyImpl) GetCustomerNameByEmail(ctx context.Context, email string) (string, error)

func (*TxJourneyImpl) GetCustomersByNameAndEmail

func (tx *TxJourneyImpl) GetCustomersByNameAndEmail(ctx context.Context, name, email string, offset, limit uint64) ([]model.Customer, error)

func (*TxJourneyImpl) GetFirstFreeTicket

func (tx *TxJourneyImpl) GetFirstFreeTicket(ctx context.Context) (*another_model.Ticket, error)

func (*TxJourneyImpl) GetTicketByID

func (tx *TxJourneyImpl) GetTicketByID(ctx context.Context, ID uint64) (*another_model.Ticket, error)

func (*TxJourneyImpl) GetTicketGreaterThanPrice

func (tx *TxJourneyImpl) GetTicketGreaterThanPrice(ctx context.Context, payload *another_model.Ticket) (another_model.Ticket, error)

func (*TxJourneyImpl) GetTicketWhichTokenIsNotEqualTo

func (tx *TxJourneyImpl) GetTicketWhichTokenIsNotEqualTo(ctx context.Context, payload map[string]interface{}) (*another_model.Ticket, error)

func (*TxJourneyImpl) GetTicketsByCustomerID

func (tx *TxJourneyImpl) GetTicketsByCustomerID(ctx context.Context, customerID uint64) ([]*another_model.Ticket, error)

func (*TxJourneyImpl) GetTicketsByFrom

func (tx *TxJourneyImpl) GetTicketsByFrom(ctx context.Context, payload another_model.Ticket) ([]*another_model.Ticket, error)

func (*TxJourneyImpl) GetTicketsByIDListAndPrice

func (tx *TxJourneyImpl) GetTicketsByIDListAndPrice(ctx context.Context, IDList []uint64, price float64) ([]*another_model.Ticket, error)

func (*TxJourneyImpl) GetTicketsByOffset

func (tx *TxJourneyImpl) GetTicketsByOffset(ctx context.Context, payload *another_model.Ticket) ([]*another_model.Ticket, error)

func (*TxJourneyImpl) GetTicketsLikeTea

func (tx *TxJourneyImpl) GetTicketsLikeTea(ctx context.Context, payload map[string]interface{}) ([]another_model.Ticket, error)

func (*TxJourneyImpl) Rollback

func (tx *TxJourneyImpl) Rollback(ctx context.Context) error

func (*TxJourneyImpl) UpdateCustomerMemberIDByID

func (tx *TxJourneyImpl) UpdateCustomerMemberIDByID(ctx context.Context, c *model.Customer) (sql.Result, error)

func (*TxJourneyImpl) UpdateCustomerMemberIDByIDList

func (tx *TxJourneyImpl) UpdateCustomerMemberIDByIDList(ctx context.Context, c *model.Customer) (sql.Result, error)

func (*TxJourneyImpl) UpdateCustomerNameByEmail

func (tx *TxJourneyImpl) UpdateCustomerNameByEmail(ctx context.Context, name, email string) (sql.Result, error)

func (*TxJourneyImpl) UpdateCustomerNameByIDList

func (tx *TxJourneyImpl) UpdateCustomerNameByIDList(ctx context.Context, name string, idList []uint64) (sql.Result, error)

Jump to

Keyboard shortcuts

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