models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountWebhook

func CountWebhook() int64

func DeleteApplicationByID

func DeleteApplicationByID(id int64) error

func DeleteCollectorByID

func DeleteCollectorByID(id int64) error

TODO: delete webhook history

func IsRecordNotFound

func IsRecordNotFound(err error) bool

func NewWebhook

func NewWebhook(webhook *Webhook) error

func RegenerateApplicationToken

func RegenerateApplicationToken(id int64) error

func RegenerateCollectorSecret

func RegenerateCollectorSecret(id int64) error

func UpdateApplication

func UpdateApplication(app *Application) error

func UpdateCollector

func UpdateCollector(collector *Collector) error

Types

type Application

type Application struct {
	ID      int64
	Name    string `sql:"unique"`
	Token   string `sql:"unique"`
	Created int64
}

Application represents a consumer application that calls APIs.

func GetApplicationByID

func GetApplicationByID(id int64) (*Application, error)

func GetApplicationByToken

func GetApplicationByToken(token string) (*Application, error)

func ListApplications

func ListApplications() ([]*Application, error)

func NewApplication

func NewApplication(name string) (*Application, error)

func (*Application) CreatedTime

func (app *Application) CreatedTime() time.Time

type CollectType

type CollectType int
const (
	COLLECT_TYPE_GITHUB CollectType = iota + 1
)

func (CollectType) String

func (t CollectType) String() string

type Collector

type Collector struct {
	ID      int64
	Name    string `sql:"unique"`
	Type    CollectType
	Secret  string `sql:"unique"`
	Created int64
}

Collector represents a type of webhook collection to be stored.

func GetCollectorByID

func GetCollectorByID(id int64) (*Collector, error)

func GetCollectorBySecret

func GetCollectorBySecret(secret string) (*Collector, error)

func ListCollectors

func ListCollectors() ([]*Collector, error)

func NewCollector

func NewCollector(name string, tp CollectType) (*Collector, error)

func (*Collector) CreatedTime

func (c *Collector) CreatedTime() time.Time

type Engine

type Engine struct {
	*gorm.DB
}

type QueryWebhookOptions

type QueryWebhookOptions struct {
	CollectorID int64
	Owner       string
	RepoName    string
	EventType   string
	Sender      string
	After       int64
	Limit       int64
	Order       string
}

type Webhook

type Webhook struct {
	ID          int64
	CollectorID int64 `sql:"index"`
	Owner       string
	RepoName    string
	EventType   string
	Sender      string
	Payload     string `sql:"type:text"`
	Created     int64
}

Webhook represents a history record of webhook.

func GetWebhookByID

func GetWebhookByID(id int64) (*Webhook, error)

func QueryWebhooks

func QueryWebhooks(opts QueryWebhookOptions) ([]*Webhook, error)

func (*Webhook) CreatedTime

func (w *Webhook) CreatedTime() time.Time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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