models

package
v0.0.0-...-654c9c4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bill

type Bill struct {
	PK             uint   `gorm:"primary_key"`
	TweetID        *int64 `json:"tweet_id,omitempty"`
	TweetUser      string `gorm:"size:250" json:"tweet_user"`
	TweetText      string `gorm:"size:300" json:"tweet_text"`
	LastTweetID    *int64 `json:"last_tweet_id,omitempty"`
	BillID         string `gorm:"size:25" json:"id,omitempty"`
	Title          string `gorm:"size:250" json:"title"`
	Classification string `gorm:"size:250" json:"classification"`
	URL            string `gorm:"size:250" json:"url"`
	Active         bool   `gorm:"default:true"`
	Data           string `gorm:"type:text"`
	NextRun        *time.Time
}

Bill is a single bill object in the database

func (*Bill) CreateTweet

func (b *Bill) CreateTweet(billURL string) string

CreateTweet makes a tweet string based on the bill's information

func (*Bill) FetchBillData

func (b *Bill) FetchBillData() (string, string, []LegistarAction, error)

FetchBillData pulls updated LegistarAction information from a bill's detail URL

func (*Bill) GetActions

func (b *Bill) GetActions() []LegistarAction

GetActions loads all actions from a bill's JSON data as LegistarAction objects

func (*Bill) GetCleanBillID

func (b *Bill) GetCleanBillID() string

GetCleanBillID returns the bill ID in a format for presentation

func (*Bill) GetTweetURL

func (b *Bill) GetTweetURL() string

GetTweetURL returns the Councilmatic URL if it exists for display and defaults to returning the bill's Legistar URL

func (*Bill) ParseBillID

func (b *Bill) ParseBillID(text string) string

ParseBillID pulls the bill identifier from a given string

func (*Bill) SearchBill

func (b *Bill) SearchBill() (string, error)

SearchBill tries to find the detail page for a bill from Legistar

func (*Bill) SetNextRun

func (b *Bill) SetNextRun()

SetNextRun updates the time the bill should be queried next

type LegistarAction

type LegistarAction struct {
	Date      time.Time `json:"date,omitempty"`
	Actor     string    `json:"actor,omitempty"`
	Action    string    `json:"action,omitempty"`
	Committee string    `json:"committee,omitempty"`
}

LegistarAction represents a single action taken on legislation

Jump to

Keyboard shortcuts

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