models

package
v0.0.0-...-5da7490 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*gorm.DB
}

func NewDB

func NewDB(c DBConfig) (db *DB, err error)

func (*DB) CreateEvent

func (db *DB) CreateEvent(c *Event) error

func (*DB) DeleteEvent

func (db *DB) DeleteEvent(c *Event) error

func (*DB) FindEventById

func (db *DB) FindEventById(c *Event, id int) error

func (*DB) FindEvents

func (db *DB) FindEvents(events *[]Event, q *Query) error

func (*DB) UpdateEvent

func (db *DB) UpdateEvent(c *Event) error

type DBConfig

type DBConfig struct {
	Url         string
	MaxIdleConn int
	MaxOpenConn int
	LogMode     bool
}

type Event

type Event struct {
	Id         uint       `json:"id",sql:"primary_key"`
	Url        string     `json:"url",sql:"not null"`
	Expression string     `json:"expression",sql:"not null"`
	Status     string     `json:"status",sql:"not null"`
	Retries    int64      `json:"retries`
	Timeout    int64      `json:"timeout`
	CreatedAt  time.Time  `json:"created_at",sql:"not null"`
	UpdatedAt  time.Time  `json:"updated_at",sql:"not null"`
	DeletedAt  *time.Time `json:"created_at,omitempty"`
}

type Query

type Query struct {
	Status     string
	Expression string
}

func NewQuery

func NewQuery(status, expression string) *Query

func (*Query) IsEmpty

func (q *Query) IsEmpty() bool

Jump to

Keyboard shortcuts

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