cmddb

package
v0.0.0-...-1a3f41a Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: MIT Imports: 7 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 {
	Deps *cmddeps.Deps
	Sesh upper.Database
	// contains filtered or unexported fields
}

DB is the database helper and holds the session to db

func (*DB) Connect

func (db *DB) Connect()

Connect establishes a connection to the database

func (*DB) CreateSlackClientsTable

func (db *DB) CreateSlackClientsTable()

CreateSlackClientsTable syncs the slack_client table

func (*DB) CreateSlackSlugOrErr

func (db *DB) CreateSlackSlugOrErr(newEntry SlackSlug) error

CreateSlackSlugOrErr inserts a new slack_slug into the db

func (*DB) GetSlackClientByTokenOrErr

func (db *DB) GetSlackClientByTokenOrErr(token string) (SlackClient, error)

GetSlackClientByTokenOrErr attempts to fetch a slack_client by its token

func (*DB) GetSlackClientsOrErr

func (db *DB) GetSlackClientsOrErr() ([]SlackClient, error)

GetSlackClientsOrErr retrieves all the slack_clients from db

type SlackClient

type SlackClient struct {
	ID          int       `db:"id" json:"id"`
	Token       string    `db:"token" json:"-"`
	Host        string    `db:"host" json:"host"`
	VersionPath string    `db:"version_path" json:"version_path"`
	Name        string    `db:"name" json:"name"`
	CreatedAt   time.Time `db:"created_at" json:"created_at"`
	UpdatedAt   time.Time `db:"updated_at" json:"updated_at"`
	// contains filtered or unexported fields
}

SlackClient is the slack_clients db model definition

func (*SlackClient) GetSlugs

func (s *SlackClient) GetSlugs() []SlackSlug

GetSlugs returns the slice of slugs for the slack_client

type SlackSlug

type SlackSlug struct {
	ID            int       `db:"id" json:"id"`
	SlackClientID int       `db:"slack_client_id" json:"slack_client_id"`
	Name          string    `db:"name" json:"name"`
	CreatedAt     time.Time `db:"created_at" json:"created_at"`
	UpdatedAt     time.Time `db:"updated_at" json:"updated_at"`
}

SlackSlug is the model definition for slack_slugs table entries

Jump to

Keyboard shortcuts

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