orgbilling

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CSVContentType = "text/csv"

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedOrganization

type AggregatedOrganization struct {
	ID                     string             `rql:"name=id,type=string"`
	Name                   string             `rql:"name=name,type=string"`
	Title                  string             `rql:"name=title,type=string"`
	CreatedBy              string             `rql:"name=created_by,type=string"`
	PlanName               string             `rql:"name=plan_name,type=string"`
	PaymentMode            string             `rql:"name=payment_mode,type=string"`
	Country                string             `rql:"name=country,type=string"`
	Avatar                 string             `rql:"name=avatar,type=string"`
	State                  organization.State `rql:"name=state,type=string"`
	CreatedAt              time.Time          `rql:"name=created_at,type=datetime"`
	UpdatedAt              time.Time          `rql:"name=updated_at,type=datetime"`
	SubscriptionCycleEndAt time.Time          `rql:"name=subscription_cycle_end_at,type=datetime"`
	SubscriptionState      string             `rql:"name=subscription_state,type=string"`
	PlanInterval           string             `rql:"name=plan_interval,type=string"`
	PlanID                 string             `rql:"name=plan_id,type=string"`
}

type CSVExport

type CSVExport struct {
	OrganizationID       string `csv:"Organization ID"`
	Name                 string `csv:"Name"`
	Title                string `csv:"Title"`
	CreatedBy            string `csv:"Created By"`
	PlanName             string `csv:"Plan Name"`
	PaymentMode          string `csv:"Payment Mode"`
	Country              string `csv:"Country"`
	State                string `csv:"State"`
	CreatedAt            string `csv:"Created At"`
	UpdatedAt            string `csv:"Updated At"`
	SubscriptionCycleEnd string `csv:"Subscription Cycle End"`
	SubscriptionState    string `csv:"Subscription State"`
	PlanInterval         string `csv:"Plan Interval"`
}

func NewCSVExport

func NewCSVExport(org AggregatedOrganization) CSVExport

FromAggregatedOrganization converts AggregatedOrganization to CSVExport

func (CSVExport) GetHeaders

func (c CSVExport) GetHeaders() []string

GetHeaders returns the CSV headers based on struct tags

func (CSVExport) ToRow

func (c CSVExport) ToRow() []string

ToRow converts the struct to a string slice for CSV writing

type Group

type Group struct {
	Name string      `json:"name"`
	Data []GroupData `json:"data"`
}

type GroupData

type GroupData struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

type OrgBilling

type OrgBilling struct {
	Organizations []AggregatedOrganization `json:"organization"`
	Group         Group                    `json:"group"`
	Pagination    Page                     `json:"pagination"`
}

type Page

type Page struct {
	Limit  int `json:"limit"`
	Offset int `json:"offset"`
}

type Repository

type Repository interface {
	Search(ctx context.Context, query *rql.Query) (OrgBilling, error)
}

type Service

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

func NewService

func NewService(repository Repository) *Service

func (Service) Export

func (s Service) Export(ctx context.Context) ([]byte, string, error)

func (Service) Search

func (s Service) Search(ctx context.Context, query *rql.Query) (OrgBilling, error)

Jump to

Keyboard shortcuts

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