transaction

package
v0.0.0-...-233daed Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Tx                     *sql.Tx
	CloseConnectionChannel chan int
}

Connection struct will hold the context of the transaction

func CreateConnection

func CreateConnection() (*Connection, error)

CreateConnection will create a connection struct to do the all import

func (*Connection) AssignPhonenumberToCategory

func (c *Connection) AssignPhonenumberToCategory(countryCode string, phonenumber string, categoryName string) error

AssignPhonenumberToCategory create an entry inside the database to link a phonenumber to a category. You must provide the country code, the value of the number and the category to assign

func (*Connection) CreateCountryTranslation

func (c *Connection) CreateCountryTranslation(countryCode string, languageCode string, value string) error

CreateCountryTranslation create an entry inside the database with the giving country code, the language code and the value of the translation

func (*Connection) CreatePhonenumber

func (c *Connection) CreatePhonenumber(countryCode string, number string) error

CreatePhonenumber create an entry inside the database with the giving country code and the number to call

func (*Connection) CreatePhonenumberCategory

func (c *Connection) CreatePhonenumberCategory(name string) error

CreatePhonenumberCategory create an entry inside the database with the giving name

func (*Connection) CreatePhonenumberCategoryTranslation

func (c *Connection) CreatePhonenumberCategoryTranslation(categoryName string, languageCode string, value string) error

CreatePhonenumberCategoryTranslation create an entry inside the database with the giving category name, the language code and the value of the translation

func (Connection) Finish

func (c Connection) Finish(err error)

Finish is the last function to call with giving error provided by every transaction to know if everything goes fine

func (*Connection) IsCategoryExist

func (c *Connection) IsCategoryExist(name string) bool

IsCategoryExist returns a boolean regard of the category exist inside the database

func (*Connection) IsCountryExist

func (c *Connection) IsCountryExist(code string) bool

IsCountryExist returns a boolean regard of the country exist inside the database

func (*Connection) IsDatabaseEmpty

func (c *Connection) IsDatabaseEmpty() (bool, error)

IsDatabaseEmpty tell you if the database is at his first pass without data inside

func (*Connection) IsLanguageExist

func (c *Connection) IsLanguageExist(code string) bool

IsLanguageExist returns a boolean regard of the language exist inside the database

func (*Connection) RemoveCountriesTranslations

func (c *Connection) RemoveCountriesTranslations() error

RemoveCountriesTranslations does a truncate on the database

func (*Connection) RemovePhonenumbersAndCategories

func (c *Connection) RemovePhonenumbersAndCategories() error

RemovePhonenumbersAndCategories does a truncate on the database

Jump to

Keyboard shortcuts

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