lawsuit

package
v0.0.0-...-62c1080 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LawsuitTableName = "lawsuit"
)
View Source
const QueueProcessName = "stiuswalProcess"

Variables

View Source
var (
	LawsuitNumberRegex = regexp.MustCompile(`^\d{7}\-\d{2}\.\d{4}\.\d{1}\.\d{2}\.\d{4}$`)
)

Functions

func Create

func Create(db *gorm.DB, lawsuit *Lawsuit) error

func DoCrawler

func DoCrawler(lawsuitNumber string) (map[string]LawSuitCrawler, error)

func IsLawsuitNumber

func IsLawsuitNumber(lawsuitNumber string) bool

func Update

func Update(db *gorm.DB, lawsuit *Lawsuit) error

Types

type LawSuitCrawler

type LawSuitCrawler struct {
	Classe                string            `json:"classe"`
	Area                  string            `json:"area"`
	Assunto               string            `json:"assunto"`
	DataDeDistribuição    string            `json:"data_de_distribuição"`
	Juiz                  string            `json:"juiz"`
	ValorDaAção           string            `json:"valor_da_ação"`
	PartesDoProcesso      []string          `json:"partes_do_processo"`
	ListaDasMovimentações map[string]string `json:"lista_das_movimentações"`
}

type Lawsuit

type Lawsuit struct {
	ID            uint           `gorm:"primary_key"`
	OrderID       string         `gorm:"column:order_id"`
	LawsuitNumber string         `gorm:"column:lawsuit_number"`
	Processed     bool           `gorm:"column:processed"`
	Criticized    bool           `gorm:"column:criticized"`
	CreatedAt     time.Time      `gorm:"column:created_at"`
	UpdatedAt     time.Time      `gorm:"column:updated_at"`
	Output        postgres.Jsonb `gorm:"column:output"`
}

func GetByOrderID

func GetByOrderID(db *gorm.DB, orderID string) (*Lawsuit, error)

func GetByOrderIDAndLawsuitNumber

func GetByOrderIDAndLawsuitNumber(db *gorm.DB, orderID string, lawsuitNumber string) (*Lawsuit, error)

func New

func New(lawsuitNumber string) *Lawsuit

func Process

func Process(db *gorm.DB, channel *amqp.Channel, lawsuitNumber string) (*Lawsuit, error)

func ProcessFinished

func ProcessFinished(db *gorm.DB, input *ProcessFinishedInput) (*Lawsuit, error)

func (*Lawsuit) Ok

func (l *Lawsuit) Ok() error

func (Lawsuit) TableName

func (Lawsuit) TableName() string

type ProcessFinishedInput

type ProcessFinishedInput struct {
	OrderID       string          `json:"order-id"`
	LawsuitNumber string          `json:"lawsuit-number"`
	Criticized    bool            `json:"criticized"`
	Output        json.RawMessage `json:"output"`
}

func (*ProcessFinishedInput) Ok

func (i *ProcessFinishedInput) Ok() error

Jump to

Keyboard shortcuts

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