model

package
v0.0.0-...-0567aa5 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	ID       int     `json:"id"`
	UserID   int     `json:"-"`
	Title    *string `json:"title"`
	Name     *string `json:"name"`
	Surname  *string `json:"surname"`
	Address  *string `json:"address"`
	ZipCode  *string `json:"zip_code"`
	Town     *string `json:"town"`
	Province *string `json:"province"`
	Country  *string `json:"country"`
	TaxCode  *string `json:"tax_code"`
	Vat      *string `json:"vat"`
	Info     *string `json:"info"`
}

+------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | id | int | NO | PRI | NULL | auto_increment | | user_id | int | YES | MUL | NULL | | | title | varchar(255) | YES | MUL | NULL | | | name | varchar(255) | YES | MUL | NULL | | | surname | varchar(255) | YES | MUL | NULL | | | address | varchar(255) | YES | | NULL | | | zip_code | varchar(255) | YES | | NULL | | | town | varchar(255) | YES | | NULL | | | province | varchar(255) | YES | | NULL | | | country | varchar(255) | YES | | NULL | | | tax_code | varchar(255) | YES | | NULL | | | vat | varchar(255) | YES | | NULL | | | created_at | datetime | NO | | NULL | | | updated_at | datetime | NO | | NULL | | | info | text | YES | | NULL | | +------------+--------------+------+-----+---------+----------------+

type CustomerInfo

type CustomerInfo struct {
	Customer *Customer
	Slips    []*Slip
}

type Database

type Database struct {
	*sql.DB
}

func (*Database) CreateCustomer

func (db *Database) CreateCustomer(c *Customer) (*Customer, error)

func (*Database) Customer

func (db *Database) Customer(id int) (*Customer, error)

func (*Database) CustomerInfo

func (db *Database) CustomerInfo(id int) (*CustomerInfo, error)

func (*Database) Customers

func (db *Database) Customers() ([]*Customer, error)

func (*Database) DeleteCustomer

func (db *Database) DeleteCustomer(id int) error

func (*Database) Slips

func (db *Database) Slips(customerId int) ([]*Slip, error)

func (*Database) UpdateCustomer

func (db *Database) UpdateCustomer(id int, c *Customer) (*Customer, error)

type DbError

type DbError struct {
	Status int
	Msg    string
}

func (*DbError) Error

func (err *DbError) Error() string

type JsonNullInt64

type JsonNullInt64 struct {
	sql.NullInt64
}

func (JsonNullInt64) MarshalJSON

func (v JsonNullInt64) MarshalJSON() ([]byte, error)

func (*JsonNullInt64) UnmarshalJSON

func (v *JsonNullInt64) UnmarshalJSON(data []byte) error

type Slip

type Slip struct {
	ID               JsonNullInt64 `json:"id"`
	CustomerID       JsonNullInt64 `json:"customer_id"`
	EstimateID       JsonNullInt64 `json:"estimate_id"`
	InvoiceID        JsonNullInt64 `json:"invoice_id"`
	InvoiceProjectID JsonNullInt64 `json:"invoice_project_id"`
	Name             *string       `json:"name"`
	Rate             *float64      `json:"rate"`
	CreatedAt        time.Time     `json:"created_at"`
	UpdatedAt        time.Time     `json:"updated_at"`
}

+--------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------------+--------------+------+-----+---------+----------------+ | id | int | NO | PRI | NULL | auto_increment | | customer_id | int | NO | MUL | NULL | | | estimate_id | int | YES | MUL | NULL | | | invoice_id | int | YES | MUL | NULL | | | invoice_project_id | int | YES | MUL | NULL | | | name | varchar(255) | NO | MUL | NULL | | | rate | decimal(8,2) | NO | | NULL | | | timed | tinyint(1) | YES | | 0 | | | duration | int | YES | | NULL | | | created_at | datetime | NO | | NULL | | | updated_at | datetime | NO | | NULL | | +--------------------+--------------+------+-----+---------+----------------+

type User

type User struct {
	ID       int     `json:"id"`
	Title    *string `json:"title"`
	Name     *string `json:"name"`
	Surname  *string `json:"surname"`
	Address  *string `json:"address"`
	ZipCode  *string `json:"zip_code"`
	Town     *string `json:"town"`
	Province *string `json:"province"`
	Country  *string `json:"country"`
	TaxCode  *string `json:"tax_code"`
	Vat      *string `json:"vat"`
	Phone    *string `json:"phone"`
	Email    *string `json:"email"`
}

+------------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------------+--------------+------+-----+---------+----------------+ | id | int | NO | PRI | NULL | auto_increment | | title | varchar(255) | YES | | NULL | | | name | varchar(255) | NO | | NULL | | | surname | varchar(255) | NO | | NULL | | | address | varchar(255) | NO | | NULL | | | zip_code | varchar(255) | NO | | NULL | | | town | varchar(255) | NO | | NULL | | | province | varchar(255) | NO | | NULL | | | country | varchar(255) | YES | | NULL | | | tax_code | varchar(255) | NO | | NULL | | | vat | varchar(255) | NO | | NULL | | | phone | varchar(255) | NO | | NULL | | | created_at | datetime | NO | | NULL | | | updated_at | datetime | NO | | NULL | | | email | varchar(255) | NO | UNI | | | | encrypted_password | varchar(128) | NO | | | | | reset_password_token | varchar(255) | YES | UNI | NULL | | | reset_password_sent_at | datetime | YES | | NULL | | | remember_created_at | datetime | YES | | NULL | | | sign_in_count | int | YES | | 0 | | | current_sign_in_at | datetime | YES | | NULL | | | last_sign_in_at | datetime | YES | | NULL | | | current_sign_in_ip | varchar(255) | YES | | NULL | | | last_sign_in_ip | varchar(255) | YES | | NULL | | | bank_coordinates | text | YES | | NULL | | | language | varchar(255) | YES | | it | | | logo_file_name | varchar(255) | YES | | NULL | | | logo_content_type | varchar(255) | YES | | NULL | | | logo_file_size | int | YES | | NULL | | | logo_updated_at | datetime | YES | | NULL | | +------------------------+--------------+------+-----+---------+----------------+

Jump to

Keyboard shortcuts

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