database

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	ID string

	Created      time.Time
	Sequence     int64  `sql:"seq"`
	DocType      string `sql:"doc_type"`
	EdgarURL     string `sql:"edgar_url"`
	Description  string `sql:"doc_desc"`
	Data         []byte `sql:"data"`
	SizeEstimate string `sql:"size_est"`
	FilingID     string `sql:"filing_id"`
}

Document is an ORM object for the `documents` table.

type DocumentDao

type DocumentDao interface {
	GetByFilingID(filingID string) (exists bool, docs []*model.Document, err error)
	GetIDs(filingID string) (exists bool, ids []string, err error)
	Get(documentID string) (exists bool, doc *model.Document, err error)
}

DocumentDao provides access to document storage.

type DocumentDaoImpl

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

DocumentDaoImpl implements DocumentDao.

func (*DocumentDaoImpl) Get

func (dao *DocumentDaoImpl) Get(documentID string) (exists bool, doc *model.Document, err error)

Get gets a doc by id.

func (*DocumentDaoImpl) GetByFilingID

func (dao *DocumentDaoImpl) GetByFilingID(filingID string) (exists bool, docs []*model.Document, err error)

GetByFilingID gets docs by filing id.

func (*DocumentDaoImpl) GetIDs

func (dao *DocumentDaoImpl) GetIDs(filingID string) (exists bool, ids []string, err error)

GetIDs gets doc ids by filing id.

type Filer

type Filer struct {
	ID             string
	Symbol         string
	CIK            string
	Name           string `sql:"name"`
	SIC            string
	SICDescription string `sql:"sic_desc"`
}

Filer is an ORM object for the `filers` table.

type FilerDao

type FilerDao interface {
	Search(condition string) (bool, []*model.Filer, error)
	GetSet(term string) (bool, []*model.Filer, error)
	Put(filer *model.Filer) (bool, error)
}

FilerDao abstracts access to sec filers.

type FilerDaoImpl

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

FilerDaoImpl implements the FilerDao.

func (*FilerDaoImpl) GetSet

func (dao *FilerDaoImpl) GetSet(term string) (found bool, filers []*model.Filer, err error)

GetSet attempts to retrieve a set of filers by symbol.

func (*FilerDaoImpl) GetSetBySIC

func (dao *FilerDaoImpl) GetSetBySIC(term string) (found bool, filers []*model.Filer, err error)

GetSetBySIC get filers by sic.

func (*FilerDaoImpl) Put

func (dao *FilerDaoImpl) Put(filer *model.Filer) (bool, error)

Put puts a potential new filer and returns whether or not it already existed..

func (*FilerDaoImpl) Search

func (dao *FilerDaoImpl) Search(condition string) (found bool, filers []*model.Filer, err error)

Search attempts to match a list of filers from a query term.

type Filing

type Filing struct {
	ID string

	Created           time.Time
	Updated           time.Time
	Filer             string
	Accession         string
	CIK               string
	EdgarURL          string    `sql:"edgar_url"`
	EdgarTime         time.Time `sql:"edgar_time"`
	FilerRelation     string    `sql:"relation"`
	FormType          string    `sql:"form_type"`
	DocumentCount     int64     `sql:"doc_count"`
	TotalSizeEstimate string    `sql:"total_size_est"`
	Symbol            string
	AllSymbols        []string `sql:"all_symbols,array"`
	AllCIKs           []string `sql:"all_ciks,array"`
}

Filing is an ORM object for the `filings` table.

type FilingDao

type FilingDao interface {
	StrictExists(cik, accession, relation string) (bool, error)
	Add(filing *model.Filing) (created *model.Filing, existed bool, err error)
	Update(filing *model.Filing) (bool, error)
	AddDocuments(filing *model.Filing, docs []*model.Document) error
	Get(accession string) (exists bool, filing *model.Filing, err error)

	GetByID(filingID string) (exists bool, filing *model.Filing, err error)
	GetBySymbol(params *QueryParams) (exists bool, result *QueryResult, err error)
	GetByCIK(params *QueryParams) (exists bool, result *QueryResult, err error)
	GetByFiler(params *QueryParams) (exists bool, result *QueryResult, err error)
	GetAll(params *QueryParams) (exists bool, result *QueryResult, err error)
}

FilingDao provides access to filing storage.

type FilingDaoImpl

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

FilingDaoImpl implements FilingDao.

func (*FilingDaoImpl) Add

func (dao *FilingDaoImpl) Add(filing *model.Filing) (created *model.Filing, existed bool, err error)

Add adds a new filing.

func (*FilingDaoImpl) AddDocuments

func (dao *FilingDaoImpl) AddDocuments(filing *model.Filing, docs []*model.Document) error

AddDocuments adds docs to an existing filing.

func (*FilingDaoImpl) Get

func (dao *FilingDaoImpl) Get(accession string) (exists bool, filing *model.Filing, err error)

Get queries a single filing.

func (*FilingDaoImpl) GetAll

func (dao *FilingDaoImpl) GetAll(params *QueryParams) (exists bool, result *QueryResult, err error)

GetAll gets filings.

func (*FilingDaoImpl) GetByCIK

func (dao *FilingDaoImpl) GetByCIK(params *QueryParams) (exists bool, result *QueryResult, err error)

GetByCIK gets filings by cik.

func (*FilingDaoImpl) GetByFiler

func (dao *FilingDaoImpl) GetByFiler(params *QueryParams) (exists bool, result *QueryResult, err error)

GetByFiler gets filings by filer name.

func (*FilingDaoImpl) GetByID

func (dao *FilingDaoImpl) GetByID(filingID string) (exists bool, filing *model.Filing, err error)

GetByID gets a filing by id.

func (*FilingDaoImpl) GetBySymbol

func (dao *FilingDaoImpl) GetBySymbol(params *QueryParams) (exists bool, result *QueryResult, err error)

GetBySymbol gets filings by symbol.

func (*FilingDaoImpl) StrictExists

func (dao *FilingDaoImpl) StrictExists(cik, accession, relation string) (bool, error)

StrictExists checks strictly.

func (*FilingDaoImpl) Update

func (dao *FilingDaoImpl) Update(filing *model.Filing) (bool, error)

Update updates an existing filing.

type Form

type Form struct {
	ID          string
	FormType    string `sql:"form_type"`
	Description string `sql:"form_desc"`
	Active      bool
}

Form is an ORM object for the `forms` table.

type FormDao

type FormDao interface {
	GetActiveForms() ([]*model.Form, error)
}

FormDao abstracts access to sec forms.

type FormDaoImpl

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

FormDaoImpl implements the FormDao.

func (*FormDaoImpl) GetActiveForms

func (dao *FormDaoImpl) GetActiveForms() (forms []*model.Form, err error)

GetActiveForms gets all the active forms.

type Handle

type Handle struct {
	*pg.DB
	// contains filtered or unexported fields
}

Handle is a database handle.

func Open

func Open(opts Options) *Handle

Open opens a new database connection.

func (*Handle) NewDocumentDao

func (h *Handle) NewDocumentDao() *DocumentDaoImpl

NewDocumentDao returns a document dao.

func (*Handle) NewFilerDao

func (h *Handle) NewFilerDao() *FilerDaoImpl

NewFilerDao returns a filer dao.

func (*Handle) NewFilingDao

func (h *Handle) NewFilingDao() *FilingDaoImpl

NewFilingDao returns a filing dao.

func (*Handle) NewFormDao

func (h *Handle) NewFormDao() *FormDaoImpl

NewFormDao returns a form dao.

type Options

type Options struct {
	Addr     string
	User     string
	Password string
	Database string
}

Options is a set of options for connecting to PostgreSQL.

type QueryParams

type QueryParams struct {
	Term  string
	Page  int
	Size  int
	Sort  int
	Form  string
	Start string
	End   string
}

QueryParams holds api query parameters.

type QueryResult

type QueryResult struct {
	Filings    []*model.Filing
	TotalCount int
}

QueryResult holds db query result.

Jump to

Keyboard shortcuts

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