models

package
v0.0.0-...-2dc3ea6 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2014 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserBodyTemplateName         = "user_body"
	SpaceBodyTemplateName        = "space_body"
	EmailBodyTemplateName        = "email_body"
	OrganizationBodyTemplateName = "organization_body"
	SubjectMissingTemplateName   = "subject.missing"
	SubjectProvidedTemplateName  = "subject.provided"
)

Variables

Functions

This section is empty.

Types

type Client

type Client struct {
	Primary     int       `db:"primary"`
	ID          string    `db:"id"`
	Description string    `db:"description"`
	CreatedAt   time.Time `db:"created_at"`
}

type ClientsRepo

type ClientsRepo struct{}

func NewClientsRepo

func NewClientsRepo() ClientsRepo

func (ClientsRepo) Create

func (repo ClientsRepo) Create(conn ConnectionInterface, client Client) (Client, error)

func (ClientsRepo) Find

func (repo ClientsRepo) Find(conn ConnectionInterface, id string) (Client, error)

func (ClientsRepo) Update

func (repo ClientsRepo) Update(conn ConnectionInterface, client Client) (Client, error)

func (ClientsRepo) Upsert

func (repo ClientsRepo) Upsert(conn ConnectionInterface, client Client) (Client, error)

type Connection

type Connection struct {
	*gorp.DbMap
}

func (*Connection) Transaction

func (conn *Connection) Transaction() TransactionInterface

type ConnectionInterface

type ConnectionInterface interface {
	Delete(...interface{}) (int64, error)
	Insert(...interface{}) error
	Select(interface{}, string, ...interface{}) ([]interface{}, error)
	SelectOne(interface{}, string, ...interface{}) error
	Update(...interface{}) (int64, error)
	Exec(string, ...interface{}) (sql.Result, error)
	Transaction() TransactionInterface
}

type DB

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

func NewDatabase

func NewDatabase(databaseURL, migrationsPath string) *DB

func (*DB) Connection

func (database *DB) Connection() ConnectionInterface

func (*DB) TraceOn

func (database *DB) TraceOn(prefix string, logger gorp.GorpLogger)

type DatabaseInterface

type DatabaseInterface interface {
	Connection() ConnectionInterface
	TraceOn(string, gorp.GorpLogger)
}

type ErrDuplicateRecord

type ErrDuplicateRecord struct{}

func (ErrDuplicateRecord) Error

func (err ErrDuplicateRecord) Error() string

type ErrRecordNotFound

type ErrRecordNotFound struct{}

func (ErrRecordNotFound) Error

func (err ErrRecordNotFound) Error() string

type GlobalUnsubscribe

type GlobalUnsubscribe struct {
	Primary   int       `db:"primary"`
	UserID    string    `db:"user_id"`
	CreatedAt time.Time `db:"created_at"`
}

type GlobalUnsubscribesRepo

type GlobalUnsubscribesRepo struct{}

func NewGlobalUnsubscribesRepo

func NewGlobalUnsubscribesRepo() GlobalUnsubscribesRepo

func (GlobalUnsubscribesRepo) Get

func (repo GlobalUnsubscribesRepo) Get(conn ConnectionInterface, userGUID string) (bool, error)

func (GlobalUnsubscribesRepo) Set

func (repo GlobalUnsubscribesRepo) Set(conn ConnectionInterface, userGUID string, unsubscribe bool) error

type GlobalUnsubscribesRepoInterface

type GlobalUnsubscribesRepoInterface interface {
	Set(ConnectionInterface, string, bool) error
	Get(ConnectionInterface, string) (bool, error)
}

type IDSet

type IDSet []string

func (IDSet) Contains

func (set IDSet) Contains(id string) bool

type Kind

type Kind struct {
	Primary     int       `db:"primary"`
	ID          string    `db:"id"`
	Description string    `db:"description"`
	Critical    bool      `db:"critical"`
	ClientID    string    `db:"client_id"`
	CreatedAt   time.Time `db:"created_at"`
}

type KindsRepo

type KindsRepo struct{}

func NewKindsRepo

func NewKindsRepo() KindsRepo

func (KindsRepo) Create

func (repo KindsRepo) Create(conn ConnectionInterface, kind Kind) (Kind, error)

func (KindsRepo) Find

func (repo KindsRepo) Find(conn ConnectionInterface, id, clientID string) (Kind, error)

func (KindsRepo) Trim

func (repo KindsRepo) Trim(conn ConnectionInterface, clientID string, kindIDs []string) (int, error)

func (KindsRepo) Update

func (repo KindsRepo) Update(conn ConnectionInterface, kind Kind) (Kind, error)

func (KindsRepo) Upsert

func (repo KindsRepo) Upsert(conn ConnectionInterface, kind Kind) (Kind, error)

type Preference

type Preference struct {
	ClientID          string `db:"client_id"`
	Count             int    `db:"count"`
	KindID            string `db:"kind_id"`
	Email             bool
	KindDescription   string `db:"kind_description"`
	SourceDescription string `db:"source_description"`
}

type PreferencesRepo

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

func NewPreferencesRepo

func NewPreferencesRepo() PreferencesRepo

func (PreferencesRepo) FindNonCriticalPreferences

func (repo PreferencesRepo) FindNonCriticalPreferences(conn ConnectionInterface, userGUID string) ([]Preference, error)

type PreferencesRepoInterface

type PreferencesRepoInterface interface {
	FindNonCriticalPreferences(ConnectionInterface, string) ([]Preference, error)
}

type Receipt

type Receipt struct {
	Primary   int       `db:"primary"`
	UserGUID  string    `db:"user_guid"`
	ClientID  string    `db:"client_id"`
	KindID    string    `db:"kind_id"`
	Count     int       `db:"count"`
	CreatedAt time.Time `db:"created_at"`
}

type ReceiptsRepo

type ReceiptsRepo struct{}

func NewReceiptsRepo

func NewReceiptsRepo() ReceiptsRepo

func (ReceiptsRepo) Create

func (repo ReceiptsRepo) Create(conn ConnectionInterface, receipt Receipt) (Receipt, error)

func (ReceiptsRepo) CreateReceipts

func (repo ReceiptsRepo) CreateReceipts(conn ConnectionInterface, userGUIDs []string, clientID, kindID string) error

func (ReceiptsRepo) Find

func (repo ReceiptsRepo) Find(conn ConnectionInterface, userGUID, clientID, kindID string) (Receipt, error)

func (ReceiptsRepo) Update

func (repo ReceiptsRepo) Update(conn ConnectionInterface, receipt Receipt) (Receipt, error)

type ReceiptsRepoInterface

type ReceiptsRepoInterface interface {
	CreateReceipts(ConnectionInterface, []string, string, string) error
}

type Template

type Template struct {
	Primary    int       `db:"primary"`
	Name       string    `db:"name"`
	Text       string    `db:"text"`
	HTML       string    `db:"html"`
	Overridden bool      `db:"-"`
	CreatedAt  time.Time `db:"created_at"`
}

type TemplatesRepo

type TemplatesRepo struct{}

func NewTemplatesRepo

func NewTemplatesRepo() TemplatesRepo

func (TemplatesRepo) Create

func (repo TemplatesRepo) Create(conn ConnectionInterface, template Template) (Template, error)

func (TemplatesRepo) Destroy

func (repo TemplatesRepo) Destroy(conn ConnectionInterface, templateName string) error

func (TemplatesRepo) Find

func (repo TemplatesRepo) Find(conn ConnectionInterface, templateName string) (Template, error)

func (TemplatesRepo) Upsert

func (repo TemplatesRepo) Upsert(conn ConnectionInterface, template Template) (Template, error)

type TemplatesRepoInterface

type TemplatesRepoInterface interface {
	Find(ConnectionInterface, string) (Template, error)
	Upsert(ConnectionInterface, Template) (Template, error)
	Destroy(ConnectionInterface, string) error
}

type Transaction

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

func (*Transaction) Begin

func (transaction *Transaction) Begin() error

func (*Transaction) Commit

func (transaction *Transaction) Commit() error

func (*Transaction) Delete

func (transaction *Transaction) Delete(v ...interface{}) (int64, error)

func (*Transaction) Exec

func (transaction *Transaction) Exec(query string, v ...interface{}) (sql.Result, error)

func (*Transaction) Insert

func (transaction *Transaction) Insert(v ...interface{}) error

func (*Transaction) Rollback

func (transaction *Transaction) Rollback() error

func (*Transaction) Select

func (transaction *Transaction) Select(holder interface{}, query string, args ...interface{}) ([]interface{}, error)

func (*Transaction) SelectOne

func (transaction *Transaction) SelectOne(holder interface{}, query string, args ...interface{}) error

func (*Transaction) Transaction

func (transaction *Transaction) Transaction() TransactionInterface

func (*Transaction) Update

func (transaction *Transaction) Update(v ...interface{}) (int64, error)

type TransactionInterface

type TransactionInterface interface {
	ConnectionInterface
	Begin() error
	Commit() error
	Rollback() error
}

func NewTransaction

func NewTransaction(conn *Connection) TransactionInterface

type Unsubscribe

type Unsubscribe struct {
	Primary   int       `db:"primary"`
	UserID    string    `db:"user_id"`
	ClientID  string    `db:"client_id"`
	KindID    string    `db:"kind_id"`
	CreatedAt time.Time `db:"created_at"`
}

type Unsubscribes

type Unsubscribes []Unsubscribe

func (Unsubscribes) Contains

func (unsubscribes Unsubscribes) Contains(clientID, kindID string) bool

type UnsubscribesRepo

type UnsubscribesRepo struct{}

func NewUnsubscribesRepo

func NewUnsubscribesRepo() UnsubscribesRepo

func (UnsubscribesRepo) Create

func (repo UnsubscribesRepo) Create(conn ConnectionInterface, unsubscribe Unsubscribe) (Unsubscribe, error)

func (UnsubscribesRepo) Destroy

func (repo UnsubscribesRepo) Destroy(conn ConnectionInterface, unsubscribe Unsubscribe) (int, error)

func (UnsubscribesRepo) Find

func (repo UnsubscribesRepo) Find(conn ConnectionInterface, clientID string, kindID string, userID string) (Unsubscribe, error)

func (UnsubscribesRepo) FindAllByUserID

func (repo UnsubscribesRepo) FindAllByUserID(conn ConnectionInterface, userID string) ([]Unsubscribe, error)

func (UnsubscribesRepo) Upsert

func (repo UnsubscribesRepo) Upsert(conn ConnectionInterface, unsubscribe Unsubscribe) (Unsubscribe, error)

Jump to

Keyboard shortcuts

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