database

package
v0.0.0-...-3b212d4 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2015 License: BSD-3-Clause, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetItem

func GetItem(dbMap *gorp.DbMap, itemID string) interface{}

func GetPaymentProvider

func GetPaymentProvider(dbMap *gorp.DbMap, id int) interface{}

func GetShippingProfile

func GetShippingProfile(dbMap *gorp.DbMap, id int) interface{}

func GetUser

func GetUser(dbMap *gorp.DbMap, user_id int) interface{}

func InitDB

func InitDB(env string) (*gorp.DbMap, error)

func NewItem

func NewItem(dbMap *gorp.DbMap, item *Item) interface{}

Types

type DatabaseConfig

type DatabaseConfig struct {
	Environments map[string]DatabaseEnvironment
}

type DatabaseEnvironment

type DatabaseEnvironment struct {
	Database string `yaml:"database"`
	User     string `yaml:"username"`
	Adapter  string `yaml:"go_adapter"`
}

type Item

type Item struct {
	Id                 string           `json:"id" db:"id"`
	Name               string           `json:"name" db:"name"`
	PurchasePriceCents int              `json:"purchase_price_cents" db:"purchase_price_cents"`
	SalePriceCents     int              `json:"sale_price_cents" db:"sale_price_cents"`
	ShippingProfileId  int              `json:"shipping_profile_id" db:"shipping_profile_id"`
	CreatedAt          time.Time        `json:"created_at" db:"created_at"`
	UpdatedAt          time.Time        `json:"updated_at" db:"updated_at"`
	ShippingProfile    *ShippingProfile `json:"shipping_profile" db:"-"`
}

func GetAllItems

func GetAllItems(dbMap *gorp.DbMap) []Item

func (*Item) CalcPotentialProfit

func (i *Item) CalcPotentialProfit(dbMap *gorp.DbMap) int

func (*Item) GetShippingProfile

func (i *Item) GetShippingProfile(dbMap *gorp.DbMap) *ShippingProfile

type PaymentProvider

type PaymentProvider struct {
	Id              int       `json:"id" db:"id"`
	Name            string    `json:"name" db:"name"`
	ListingFeeCents int       `json:"listing_fee_cents" db:"listing_fee_cents"`
	PercentageFeeBp int       `json:"percentage_fee_bp" db:"percentage_fee_bp"`
	FlatFeeCents    int       `json:"flat_fee_cents" db:"flat_fee_cents"`
	CreatedAt       time.Time `json:"created_at" db:"created_at"`
	UpdatedAt       time.Time `json:"updated_at" db:"updated_at"`
}

func GetAllPaymentProviders

func GetAllPaymentProviders(dbMap *gorp.DbMap) []PaymentProvider

type ShippingProfile

type ShippingProfile struct {
	Id          int       `json:"id" db:"id"`
	UseId       int       `json:"user_id" db:"user_id"`
	User        *User     `json:"user"`
	Name        string    `json:"name" db:"name"`
	CostInCents int       `json:"cost_in_cents" db:"cost_in_cents"`
	CreatedAt   time.Time `json:"created_at" db:"created_at"`
	UpdatedAt   time.Time `json:"updated_at" db:"updated_at"`
}

func GetAllShippingProfiles

func GetAllShippingProfiles(dbMap *gorp.DbMap) []ShippingProfile

type User

type User struct {
	Id        string    `json:"id" db:"id"`
	Email     string    `json:"email" db:"email"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdateAt  time.Time `json:"updated_at" db:"updated_at"`
}

Jump to

Keyboard shortcuts

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