db

package
v0.0.0-...-ec3fada Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Invoice

type Invoice struct {
	Id           uuid.UUID      `gorm:"primaryKey;type:uuid"`
	InvoiceeId   uuid.UUID      `gorm:"uniqueIndex:invoicee_id_period,where:deleted_at is null;not null;type:uuid"`
	InvoiceeType InvoiceeType   `gorm:"not null"`
	NetworkId    uuid.UUID      `gorm:"type:uuid"`
	Period       time.Time      `gorm:"uniqueIndex:invoicee_id_period,where:deleted_at is null;not null"`
	RawInvoice   datatypes.JSON `gorm:"not null"`
	IsPaid       bool           `gorm:"default:false"`
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    gorm.DeletedAt `gorm:"index"`
}

type InvoiceRepo

type InvoiceRepo interface {
	Add(invoice *Invoice, nestedFunc func(*Invoice, *gorm.DB) error) error
	Get(id uuid.UUID) (*Invoice, error)
	List(invoiceeId string, invoiceeType InvoiceeType, networkId string,
		isPaid bool, count uint32, sort bool) ([]Invoice, error)

	// Update(orgId uint, network *Network) error
	Delete(invoiceId uuid.UUID, nestedFunc func(uuid.UUID, *gorm.DB) error) error
}

func NewInvoiceRepo

func NewInvoiceRepo(db sql.Db) InvoiceRepo

type InvoiceeType

type InvoiceeType uint8
const (
	InvoiceeTypeUnknown InvoiceeType = iota
	InvoiceeTypeOrg
	InvoiceeTypeSubscriber
)

func ParseInvoiceeType

func ParseInvoiceeType(value string) InvoiceeType

func (*InvoiceeType) Scan

func (s *InvoiceeType) Scan(value interface{}) error

func (InvoiceeType) String

func (s InvoiceeType) String() string

func (InvoiceeType) Value

func (s InvoiceeType) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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