model

package
v0.0.0-...-c702557 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateNew     = "new"
	StateOld     = "old"
	StateDeleted = "deleted"
)
View Source
const EntityTable = "entities"
View Source
const SourceTable = "sources"

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	SourceName  string `json:"-"`
	Action      string `json:"action"`
	State       State  `json:"state"`
	IsProcessed bool   `json:"is_processed"`
}

type EntityPresenter

type EntityPresenter struct {
	ID          int        `db:"id" json:"id"`
	CreatedAt   *time.Time `db:"created_at" json:"created_at"`
	SourceID    *int       `db:"source_id" json:"source_id"`
	Action      string     `db:"action" json:"action"`
	State       State      `db:"state" json:"state"`
	IsProcessed bool       `db:"is_processed" json:"is_processed"`
}

type Manager

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

func NewManager

func NewManager(db *sqlx.DB) *Manager

func (*Manager) ExecTx

func (m *Manager) ExecTx(query string, args ...interface{}) error

func (*Manager) Insert

func (m *Manager) Insert(e *Entity) error

func (*Manager) ListEntities

func (m *Manager) ListEntities() ([]*EntityPresenter, error)

func (*Manager) ListSources

func (m *Manager) ListSources() ([]*SourcePresenter, error)

type SourcePresenter

type SourcePresenter struct {
	ID   int    `db:"id" json:"id"`
	Name string `db:"name" json:"name"`
}

type State

type State string

Jump to

Keyboard shortcuts

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