Documentation
¶
Overview ¶
Package investor is an Arandu module: one entity with its generated query, one policy that decides about it, one service that orchestrates each use case, and the routes that reach them.
The files are laid out by role rather than by layer, so the whole package reads top to bottom:
module.go -> registration, routes, handlers and migrations config.go -> what the application passes in model.go -> the entity, and what it may answer with policy.go -> who may do what service.go -> the use cases, and Model access after authorization views.go -> the files the application takes ownership of
An application registers it explicitly. There is no service provider, no container and no discovery: the wiring is three lines somebody wrote, and reading them is how they learn what the application is made of.
Index ¶
- Constants
- Variables
- func AllocateCosts(costs []ScopedCost, revenue map[string]int64, contract Scope) int64
- func CompleteFilters(rows []components.TableRow, filters ...components.DataTableFilter) []components.DataTableFilter
- func CostInWindow(item CostItem, start, end Day, billingDay int) int64
- func IsAdmin(s security.Subject) bool
- func Lines(locale string) translation.Lines
- func Locales() []string
- func NextOnly(next string) components.Paginator
- func PublishedPaths() []string
- func ViewNames() []string
- func ViewPackages() []string
- type AccountOption
- type AdminCostsPageData
- type AdminEntriesPageData
- type AdminInvestorPageData
- type AdminInvestorsPageData
- type AdminWithdrawalsPageData
- type BankAccountRequest
- type CellInput
- type ChromeRequest
- type Collection
- type Config
- type Contract
- type ContractCollection
- func (c ContractCollection) Contains(key any) bool
- func (c ContractCollection) Except(keys ...any) ContractCollection
- func (c ContractCollection) Find(key any) *Contract
- func (c ContractCollection) FindOrFail(key any) (*Contract, error)
- func (c ContractCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (ContractCollection, error)
- func (c ContractCollection) Load(ctx context.Context, g auth.Grant, relations ...string) error
- func (c ContractCollection) LoadCount(ctx context.Context, g auth.Grant, relations ...string) error
- func (c ContractCollection) LoadMissing(ctx context.Context, g auth.Grant, relations ...string) error
- func (c ContractCollection) ModelKeys() []any
- func (c ContractCollection) Only(keys ...any) ContractCollection
- func (c ContractCollection) Pluck(column string) []any
- func (c ContractCollection) Rows() model.Rows
- func (c ContractCollection) ToArray() []map[string]any
- func (c ContractCollection) Unique() ContractCollection
- type ContractList
- type ContractProduct
- type ContractProductCollection
- func (c ContractProductCollection) Contains(key any) bool
- func (c ContractProductCollection) Except(keys ...any) ContractProductCollection
- func (c ContractProductCollection) Find(key any) *ContractProduct
- func (c ContractProductCollection) FindOrFail(key any) (*ContractProduct, error)
- func (c ContractProductCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (ContractProductCollection, error)
- func (c ContractProductCollection) Load(ctx context.Context, g auth.Grant, relations ...string) error
- func (c ContractProductCollection) LoadCount(ctx context.Context, g auth.Grant, relations ...string) error
- func (c ContractProductCollection) LoadMissing(ctx context.Context, g auth.Grant, relations ...string) error
- func (c ContractProductCollection) ModelKeys() []any
- func (c ContractProductCollection) Only(keys ...any) ContractProductCollection
- func (c ContractProductCollection) Pluck(column string) []any
- func (c ContractProductCollection) Rows() model.Rows
- func (c ContractProductCollection) ToArray() []map[string]any
- func (c ContractProductCollection) Unique() ContractProductCollection
- type ContractProductQuery
- func (q *ContractProductQuery) AddSelect(columns ...any) *ContractProductQuery
- func (q *ContractProductQuery) Avg(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *ContractProductQuery) Base() *model.Builder
- func (q *ContractProductQuery) Chunk(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *ContractProductQuery) Clone() *ContractProductQuery
- func (q *ContractProductQuery) Count(ctx context.Context, g auth.Grant, columns ...any) (int64, error)
- func (q *ContractProductQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*ContractProduct, error)
- func (q *ContractProductQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*ContractProduct, error]
- func (q *ContractProductQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, ...) (ContractProductCollection, *pagination.CursorPage, error)
- func (q *ContractProductQuery) Decrement(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *ContractProductQuery) Delete(ctx context.Context, g auth.Grant) (int64, error)
- func (q *ContractProductQuery) DoesntExist(ctx context.Context, g auth.Grant) (bool, error)
- func (q *ContractProductQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *ContractProductQuery
- func (q *ContractProductQuery) Each(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *ContractProductQuery) Exists(ctx context.Context, g auth.Grant) (bool, error)
- func (q *ContractProductQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*ContractProduct, error)
- func (q *ContractProductQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (ContractProductCollection, error)
- func (q *ContractProductQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*ContractProduct, error)
- func (q *ContractProductQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*ContractProduct, error)
- func (q *ContractProductQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*ContractProduct, error)
- func (q *ContractProductQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*ContractProduct, error)
- func (q *ContractProductQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*ContractProduct, error)
- func (q *ContractProductQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*ContractProduct, error)
- func (q *ContractProductQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*ContractProduct, error)
- func (q *ContractProductQuery) ForPage(page, perPage int) *ContractProductQuery
- func (q *ContractProductQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*ContractProduct, error)
- func (q *ContractProductQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (ContractProductCollection, error)
- func (q *ContractProductQuery) GroupBy(groups ...any) *ContractProductQuery
- func (q *ContractProductQuery) Has(relation, operator string, count int, boolean string, ...) *ContractProductQuery
- func (q *ContractProductQuery) Increment(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *ContractProductQuery) Insert(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *ContractProductQuery) InsertOrIgnore(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *ContractProductQuery) Join(table any, first any, args ...any) *ContractProductQuery
- func (q *ContractProductQuery) Latest(column ...string) *ContractProductQuery
- func (q *ContractProductQuery) Limit(value int) *ContractProductQuery
- func (q *ContractProductQuery) Max(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *ContractProductQuery) Min(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *ContractProductQuery) New() (*ContractProduct, error)
- func (q *ContractProductQuery) Offset(value int) *ContractProductQuery
- func (q *ContractProductQuery) Oldest(column ...string) *ContractProductQuery
- func (q *ContractProductQuery) OrDoesntHave(relation string) *ContractProductQuery
- func (q *ContractProductQuery) OrHas(relation, operator string, count int) *ContractProductQuery
- func (q *ContractProductQuery) OrWhere(column any, args ...any) *ContractProductQuery
- func (q *ContractProductQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *ContractProductQuery
- func (q *ContractProductQuery) OrWhereHas(relation string, callback func(*query.Builder)) *ContractProductQuery
- func (q *ContractProductQuery) OrWhereNot(column any, args ...any) *ContractProductQuery
- func (q *ContractProductQuery) OrWhereRelation(relation string, column any, args ...any) *ContractProductQuery
- func (q *ContractProductQuery) OrderBy(column any, direction ...string) *ContractProductQuery
- func (q *ContractProductQuery) OrderByDesc(column any) *ContractProductQuery
- func (q *ContractProductQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (ContractProductCollection, *pagination.LengthAwarePage, error)
- func (q *ContractProductQuery) Pluck(ctx context.Context, g auth.Grant, column string) ([]any, error)
- func (q *ContractProductQuery) Select(columns ...any) *ContractProductQuery
- func (q *ContractProductQuery) SelectRaw(expression string, bindings ...any) *ContractProductQuery
- func (q *ContractProductQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (ContractProductCollection, *pagination.Page, error)
- func (q *ContractProductQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*ContractProduct, error)
- func (q *ContractProductQuery) SoleValue(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *ContractProductQuery) Sum(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *ContractProductQuery) Touch(ctx context.Context, g auth.Grant, column ...string) (int64, error)
- func (q *ContractProductQuery) Update(ctx context.Context, g auth.Grant, values map[string]any) (int64, error)
- func (q *ContractProductQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*ContractProduct, error)
- func (q *ContractProductQuery) Upsert(ctx context.Context, g auth.Grant, values []map[string]any, ...) (int64, error)
- func (q *ContractProductQuery) Value(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *ContractProductQuery) ValueOrFail(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *ContractProductQuery) Where(column any, args ...any) *ContractProductQuery
- func (q *ContractProductQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *ContractProductQuery
- func (q *ContractProductQuery) WhereBetween(column any, from, to any) *ContractProductQuery
- func (q *ContractProductQuery) WhereColumn(first any, args ...any) *ContractProductQuery
- func (q *ContractProductQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *ContractProductQuery
- func (q *ContractProductQuery) WhereExists(callback func(*query.Builder)) *ContractProductQuery
- func (q *ContractProductQuery) WhereHas(relation string, callback func(*query.Builder)) *ContractProductQuery
- func (q *ContractProductQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *ContractProductQuery
- func (q *ContractProductQuery) WhereIn(column any, values []any) *ContractProductQuery
- func (q *ContractProductQuery) WhereKey(id any) *ContractProductQuery
- func (q *ContractProductQuery) WhereNot(column any, args ...any) *ContractProductQuery
- func (q *ContractProductQuery) WhereNotExists(callback func(*query.Builder)) *ContractProductQuery
- func (q *ContractProductQuery) WhereNotIn(column any, values []any) *ContractProductQuery
- func (q *ContractProductQuery) WhereNotNull(columns ...any) *ContractProductQuery
- func (q *ContractProductQuery) WhereNull(columns ...any) *ContractProductQuery
- func (q *ContractProductQuery) WhereRelation(relation string, column any, args ...any) *ContractProductQuery
- func (q *ContractProductQuery) With(relations ...string) *ContractProductQuery
- func (q *ContractProductQuery) WithAvg(relation, column string) *ContractProductQuery
- func (q *ContractProductQuery) WithCount(relations ...string) *ContractProductQuery
- func (q *ContractProductQuery) WithExists(relation string) *ContractProductQuery
- func (q *ContractProductQuery) WithMax(relation, column string) *ContractProductQuery
- func (q *ContractProductQuery) WithMin(relation, column string) *ContractProductQuery
- func (q *ContractProductQuery) WithSum(relation, column string) *ContractProductQuery
- func (q *ContractProductQuery) Without(relations ...string) *ContractProductQuery
- func (q *ContractProductQuery) WithoutGlobalScope(identifier string) *ContractProductQuery
- func (q *ContractProductQuery) WithoutGlobalScopes(identifiers ...string) *ContractProductQuery
- type ContractQuery
- func (q *ContractQuery) AddSelect(columns ...any) *ContractQuery
- func (q *ContractQuery) Avg(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *ContractQuery) Base() *model.Builder
- func (q *ContractQuery) Chunk(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *ContractQuery) Clone() *ContractQuery
- func (q *ContractQuery) Count(ctx context.Context, g auth.Grant, columns ...any) (int64, error)
- func (q *ContractQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*Contract, error)
- func (q *ContractQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*Contract, error]
- func (q *ContractQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, ...) (ContractCollection, *pagination.CursorPage, error)
- func (q *ContractQuery) Decrement(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *ContractQuery) Delete(ctx context.Context, g auth.Grant) (int64, error)
- func (q *ContractQuery) DoesntExist(ctx context.Context, g auth.Grant) (bool, error)
- func (q *ContractQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *ContractQuery
- func (q *ContractQuery) Each(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *ContractQuery) Exists(ctx context.Context, g auth.Grant) (bool, error)
- func (q *ContractQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*Contract, error)
- func (q *ContractQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (ContractCollection, error)
- func (q *ContractQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*Contract, error)
- func (q *ContractQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*Contract, error)
- func (q *ContractQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*Contract, error)
- func (q *ContractQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Contract, error)
- func (q *ContractQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*Contract, error)
- func (q *ContractQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Contract, error)
- func (q *ContractQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*Contract, error)
- func (q *ContractQuery) ForPage(page, perPage int) *ContractQuery
- func (q *ContractQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*Contract, error)
- func (q *ContractQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (ContractCollection, error)
- func (q *ContractQuery) GroupBy(groups ...any) *ContractQuery
- func (q *ContractQuery) Has(relation, operator string, count int, boolean string, ...) *ContractQuery
- func (q *ContractQuery) Increment(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *ContractQuery) Insert(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *ContractQuery) InsertOrIgnore(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *ContractQuery) Join(table any, first any, args ...any) *ContractQuery
- func (q *ContractQuery) Latest(column ...string) *ContractQuery
- func (q *ContractQuery) Limit(value int) *ContractQuery
- func (q *ContractQuery) Max(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *ContractQuery) Min(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *ContractQuery) New() (*Contract, error)
- func (q *ContractQuery) Offset(value int) *ContractQuery
- func (q *ContractQuery) Oldest(column ...string) *ContractQuery
- func (q *ContractQuery) OrDoesntHave(relation string) *ContractQuery
- func (q *ContractQuery) OrHas(relation, operator string, count int) *ContractQuery
- func (q *ContractQuery) OrWhere(column any, args ...any) *ContractQuery
- func (q *ContractQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *ContractQuery
- func (q *ContractQuery) OrWhereHas(relation string, callback func(*query.Builder)) *ContractQuery
- func (q *ContractQuery) OrWhereNot(column any, args ...any) *ContractQuery
- func (q *ContractQuery) OrWhereRelation(relation string, column any, args ...any) *ContractQuery
- func (q *ContractQuery) OrderBy(column any, direction ...string) *ContractQuery
- func (q *ContractQuery) OrderByDesc(column any) *ContractQuery
- func (q *ContractQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (ContractCollection, *pagination.LengthAwarePage, error)
- func (q *ContractQuery) Pluck(ctx context.Context, g auth.Grant, column string) ([]any, error)
- func (q *ContractQuery) Select(columns ...any) *ContractQuery
- func (q *ContractQuery) SelectRaw(expression string, bindings ...any) *ContractQuery
- func (q *ContractQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (ContractCollection, *pagination.Page, error)
- func (q *ContractQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*Contract, error)
- func (q *ContractQuery) SoleValue(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *ContractQuery) Sum(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *ContractQuery) Touch(ctx context.Context, g auth.Grant, column ...string) (int64, error)
- func (q *ContractQuery) Update(ctx context.Context, g auth.Grant, values map[string]any) (int64, error)
- func (q *ContractQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Contract, error)
- func (q *ContractQuery) Upsert(ctx context.Context, g auth.Grant, values []map[string]any, ...) (int64, error)
- func (q *ContractQuery) Value(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *ContractQuery) ValueOrFail(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *ContractQuery) Where(column any, args ...any) *ContractQuery
- func (q *ContractQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *ContractQuery
- func (q *ContractQuery) WhereBetween(column any, from, to any) *ContractQuery
- func (q *ContractQuery) WhereColumn(first any, args ...any) *ContractQuery
- func (q *ContractQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *ContractQuery
- func (q *ContractQuery) WhereExists(callback func(*query.Builder)) *ContractQuery
- func (q *ContractQuery) WhereHas(relation string, callback func(*query.Builder)) *ContractQuery
- func (q *ContractQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *ContractQuery
- func (q *ContractQuery) WhereIn(column any, values []any) *ContractQuery
- func (q *ContractQuery) WhereKey(id any) *ContractQuery
- func (q *ContractQuery) WhereNot(column any, args ...any) *ContractQuery
- func (q *ContractQuery) WhereNotExists(callback func(*query.Builder)) *ContractQuery
- func (q *ContractQuery) WhereNotIn(column any, values []any) *ContractQuery
- func (q *ContractQuery) WhereNotNull(columns ...any) *ContractQuery
- func (q *ContractQuery) WhereNull(columns ...any) *ContractQuery
- func (q *ContractQuery) WhereRelation(relation string, column any, args ...any) *ContractQuery
- func (q *ContractQuery) With(relations ...string) *ContractQuery
- func (q *ContractQuery) WithAvg(relation, column string) *ContractQuery
- func (q *ContractQuery) WithCount(relations ...string) *ContractQuery
- func (q *ContractQuery) WithExists(relation string) *ContractQuery
- func (q *ContractQuery) WithMax(relation, column string) *ContractQuery
- func (q *ContractQuery) WithMin(relation, column string) *ContractQuery
- func (q *ContractQuery) WithSum(relation, column string) *ContractQuery
- func (q *ContractQuery) Without(relations ...string) *ContractQuery
- func (q *ContractQuery) WithoutGlobalScope(identifier string) *ContractQuery
- func (q *ContractQuery) WithoutGlobalScopes(identifiers ...string) *ContractQuery
- type ContractRequest
- type ContractResource
- type ContractRow
- type ContractStatus
- type CostItem
- type CostItemCollection
- func (c CostItemCollection) Contains(key any) bool
- func (c CostItemCollection) Except(keys ...any) CostItemCollection
- func (c CostItemCollection) Find(key any) *CostItem
- func (c CostItemCollection) FindOrFail(key any) (*CostItem, error)
- func (c CostItemCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (CostItemCollection, error)
- func (c CostItemCollection) Load(ctx context.Context, g auth.Grant, relations ...string) error
- func (c CostItemCollection) LoadCount(ctx context.Context, g auth.Grant, relations ...string) error
- func (c CostItemCollection) LoadMissing(ctx context.Context, g auth.Grant, relations ...string) error
- func (c CostItemCollection) ModelKeys() []any
- func (c CostItemCollection) Only(keys ...any) CostItemCollection
- func (c CostItemCollection) Pluck(column string) []any
- func (c CostItemCollection) Rows() model.Rows
- func (c CostItemCollection) ToArray() []map[string]any
- func (c CostItemCollection) Unique() CostItemCollection
- type CostItemProduct
- type CostItemProductCollection
- func (c CostItemProductCollection) Contains(key any) bool
- func (c CostItemProductCollection) Except(keys ...any) CostItemProductCollection
- func (c CostItemProductCollection) Find(key any) *CostItemProduct
- func (c CostItemProductCollection) FindOrFail(key any) (*CostItemProduct, error)
- func (c CostItemProductCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (CostItemProductCollection, error)
- func (c CostItemProductCollection) Load(ctx context.Context, g auth.Grant, relations ...string) error
- func (c CostItemProductCollection) LoadCount(ctx context.Context, g auth.Grant, relations ...string) error
- func (c CostItemProductCollection) LoadMissing(ctx context.Context, g auth.Grant, relations ...string) error
- func (c CostItemProductCollection) ModelKeys() []any
- func (c CostItemProductCollection) Only(keys ...any) CostItemProductCollection
- func (c CostItemProductCollection) Pluck(column string) []any
- func (c CostItemProductCollection) Rows() model.Rows
- func (c CostItemProductCollection) ToArray() []map[string]any
- func (c CostItemProductCollection) Unique() CostItemProductCollection
- type CostItemProductQuery
- func (q *CostItemProductQuery) AddSelect(columns ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) Avg(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *CostItemProductQuery) Base() *model.Builder
- func (q *CostItemProductQuery) Chunk(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *CostItemProductQuery) Clone() *CostItemProductQuery
- func (q *CostItemProductQuery) Count(ctx context.Context, g auth.Grant, columns ...any) (int64, error)
- func (q *CostItemProductQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*CostItemProduct, error]
- func (q *CostItemProductQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, ...) (CostItemProductCollection, *pagination.CursorPage, error)
- func (q *CostItemProductQuery) Decrement(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *CostItemProductQuery) Delete(ctx context.Context, g auth.Grant) (int64, error)
- func (q *CostItemProductQuery) DoesntExist(ctx context.Context, g auth.Grant) (bool, error)
- func (q *CostItemProductQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *CostItemProductQuery
- func (q *CostItemProductQuery) Each(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *CostItemProductQuery) Exists(ctx context.Context, g auth.Grant) (bool, error)
- func (q *CostItemProductQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (CostItemProductCollection, error)
- func (q *CostItemProductQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) ForPage(page, perPage int) *CostItemProductQuery
- func (q *CostItemProductQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (CostItemProductCollection, error)
- func (q *CostItemProductQuery) GroupBy(groups ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) Has(relation, operator string, count int, boolean string, ...) *CostItemProductQuery
- func (q *CostItemProductQuery) Increment(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *CostItemProductQuery) Insert(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *CostItemProductQuery) InsertOrIgnore(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *CostItemProductQuery) Join(table any, first any, args ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) Latest(column ...string) *CostItemProductQuery
- func (q *CostItemProductQuery) Limit(value int) *CostItemProductQuery
- func (q *CostItemProductQuery) Max(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *CostItemProductQuery) Min(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *CostItemProductQuery) New() (*CostItemProduct, error)
- func (q *CostItemProductQuery) Offset(value int) *CostItemProductQuery
- func (q *CostItemProductQuery) Oldest(column ...string) *CostItemProductQuery
- func (q *CostItemProductQuery) OrDoesntHave(relation string) *CostItemProductQuery
- func (q *CostItemProductQuery) OrHas(relation, operator string, count int) *CostItemProductQuery
- func (q *CostItemProductQuery) OrWhere(column any, args ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *CostItemProductQuery
- func (q *CostItemProductQuery) OrWhereHas(relation string, callback func(*query.Builder)) *CostItemProductQuery
- func (q *CostItemProductQuery) OrWhereNot(column any, args ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) OrWhereRelation(relation string, column any, args ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) OrderBy(column any, direction ...string) *CostItemProductQuery
- func (q *CostItemProductQuery) OrderByDesc(column any) *CostItemProductQuery
- func (q *CostItemProductQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (CostItemProductCollection, *pagination.LengthAwarePage, error)
- func (q *CostItemProductQuery) Pluck(ctx context.Context, g auth.Grant, column string) ([]any, error)
- func (q *CostItemProductQuery) Select(columns ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) SelectRaw(expression string, bindings ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (CostItemProductCollection, *pagination.Page, error)
- func (q *CostItemProductQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) SoleValue(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *CostItemProductQuery) Sum(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *CostItemProductQuery) Touch(ctx context.Context, g auth.Grant, column ...string) (int64, error)
- func (q *CostItemProductQuery) Update(ctx context.Context, g auth.Grant, values map[string]any) (int64, error)
- func (q *CostItemProductQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*CostItemProduct, error)
- func (q *CostItemProductQuery) Upsert(ctx context.Context, g auth.Grant, values []map[string]any, ...) (int64, error)
- func (q *CostItemProductQuery) Value(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *CostItemProductQuery) ValueOrFail(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *CostItemProductQuery) Where(column any, args ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereBetween(column any, from, to any) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereColumn(first any, args ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereExists(callback func(*query.Builder)) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereHas(relation string, callback func(*query.Builder)) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereIn(column any, values []any) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereKey(id any) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereNot(column any, args ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereNotExists(callback func(*query.Builder)) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereNotIn(column any, values []any) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereNotNull(columns ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereNull(columns ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) WhereRelation(relation string, column any, args ...any) *CostItemProductQuery
- func (q *CostItemProductQuery) With(relations ...string) *CostItemProductQuery
- func (q *CostItemProductQuery) WithAvg(relation, column string) *CostItemProductQuery
- func (q *CostItemProductQuery) WithCount(relations ...string) *CostItemProductQuery
- func (q *CostItemProductQuery) WithExists(relation string) *CostItemProductQuery
- func (q *CostItemProductQuery) WithMax(relation, column string) *CostItemProductQuery
- func (q *CostItemProductQuery) WithMin(relation, column string) *CostItemProductQuery
- func (q *CostItemProductQuery) WithSum(relation, column string) *CostItemProductQuery
- func (q *CostItemProductQuery) Without(relations ...string) *CostItemProductQuery
- func (q *CostItemProductQuery) WithoutGlobalScope(identifier string) *CostItemProductQuery
- func (q *CostItemProductQuery) WithoutGlobalScopes(identifiers ...string) *CostItemProductQuery
- type CostItemQuery
- func (q *CostItemQuery) AddSelect(columns ...any) *CostItemQuery
- func (q *CostItemQuery) Avg(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *CostItemQuery) Base() *model.Builder
- func (q *CostItemQuery) Chunk(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *CostItemQuery) Clone() *CostItemQuery
- func (q *CostItemQuery) Count(ctx context.Context, g auth.Grant, columns ...any) (int64, error)
- func (q *CostItemQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*CostItem, error)
- func (q *CostItemQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*CostItem, error]
- func (q *CostItemQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, ...) (CostItemCollection, *pagination.CursorPage, error)
- func (q *CostItemQuery) Decrement(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *CostItemQuery) Delete(ctx context.Context, g auth.Grant) (int64, error)
- func (q *CostItemQuery) DoesntExist(ctx context.Context, g auth.Grant) (bool, error)
- func (q *CostItemQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *CostItemQuery
- func (q *CostItemQuery) Each(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *CostItemQuery) Exists(ctx context.Context, g auth.Grant) (bool, error)
- func (q *CostItemQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*CostItem, error)
- func (q *CostItemQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (CostItemCollection, error)
- func (q *CostItemQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*CostItem, error)
- func (q *CostItemQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*CostItem, error)
- func (q *CostItemQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*CostItem, error)
- func (q *CostItemQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*CostItem, error)
- func (q *CostItemQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*CostItem, error)
- func (q *CostItemQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*CostItem, error)
- func (q *CostItemQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*CostItem, error)
- func (q *CostItemQuery) ForPage(page, perPage int) *CostItemQuery
- func (q *CostItemQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*CostItem, error)
- func (q *CostItemQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (CostItemCollection, error)
- func (q *CostItemQuery) GroupBy(groups ...any) *CostItemQuery
- func (q *CostItemQuery) Has(relation, operator string, count int, boolean string, ...) *CostItemQuery
- func (q *CostItemQuery) Increment(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *CostItemQuery) Insert(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *CostItemQuery) InsertOrIgnore(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *CostItemQuery) Join(table any, first any, args ...any) *CostItemQuery
- func (q *CostItemQuery) Latest(column ...string) *CostItemQuery
- func (q *CostItemQuery) Limit(value int) *CostItemQuery
- func (q *CostItemQuery) Max(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *CostItemQuery) Min(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *CostItemQuery) New() (*CostItem, error)
- func (q *CostItemQuery) Offset(value int) *CostItemQuery
- func (q *CostItemQuery) Oldest(column ...string) *CostItemQuery
- func (q *CostItemQuery) OrDoesntHave(relation string) *CostItemQuery
- func (q *CostItemQuery) OrHas(relation, operator string, count int) *CostItemQuery
- func (q *CostItemQuery) OrWhere(column any, args ...any) *CostItemQuery
- func (q *CostItemQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *CostItemQuery
- func (q *CostItemQuery) OrWhereHas(relation string, callback func(*query.Builder)) *CostItemQuery
- func (q *CostItemQuery) OrWhereNot(column any, args ...any) *CostItemQuery
- func (q *CostItemQuery) OrWhereRelation(relation string, column any, args ...any) *CostItemQuery
- func (q *CostItemQuery) OrderBy(column any, direction ...string) *CostItemQuery
- func (q *CostItemQuery) OrderByDesc(column any) *CostItemQuery
- func (q *CostItemQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (CostItemCollection, *pagination.LengthAwarePage, error)
- func (q *CostItemQuery) Pluck(ctx context.Context, g auth.Grant, column string) ([]any, error)
- func (q *CostItemQuery) Select(columns ...any) *CostItemQuery
- func (q *CostItemQuery) SelectRaw(expression string, bindings ...any) *CostItemQuery
- func (q *CostItemQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (CostItemCollection, *pagination.Page, error)
- func (q *CostItemQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*CostItem, error)
- func (q *CostItemQuery) SoleValue(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *CostItemQuery) Sum(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *CostItemQuery) Touch(ctx context.Context, g auth.Grant, column ...string) (int64, error)
- func (q *CostItemQuery) Update(ctx context.Context, g auth.Grant, values map[string]any) (int64, error)
- func (q *CostItemQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*CostItem, error)
- func (q *CostItemQuery) Upsert(ctx context.Context, g auth.Grant, values []map[string]any, ...) (int64, error)
- func (q *CostItemQuery) Value(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *CostItemQuery) ValueOrFail(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *CostItemQuery) Where(column any, args ...any) *CostItemQuery
- func (q *CostItemQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *CostItemQuery
- func (q *CostItemQuery) WhereBetween(column any, from, to any) *CostItemQuery
- func (q *CostItemQuery) WhereColumn(first any, args ...any) *CostItemQuery
- func (q *CostItemQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *CostItemQuery
- func (q *CostItemQuery) WhereExists(callback func(*query.Builder)) *CostItemQuery
- func (q *CostItemQuery) WhereHas(relation string, callback func(*query.Builder)) *CostItemQuery
- func (q *CostItemQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *CostItemQuery
- func (q *CostItemQuery) WhereIn(column any, values []any) *CostItemQuery
- func (q *CostItemQuery) WhereKey(id any) *CostItemQuery
- func (q *CostItemQuery) WhereNot(column any, args ...any) *CostItemQuery
- func (q *CostItemQuery) WhereNotExists(callback func(*query.Builder)) *CostItemQuery
- func (q *CostItemQuery) WhereNotIn(column any, values []any) *CostItemQuery
- func (q *CostItemQuery) WhereNotNull(columns ...any) *CostItemQuery
- func (q *CostItemQuery) WhereNull(columns ...any) *CostItemQuery
- func (q *CostItemQuery) WhereRelation(relation string, column any, args ...any) *CostItemQuery
- func (q *CostItemQuery) With(relations ...string) *CostItemQuery
- func (q *CostItemQuery) WithAvg(relation, column string) *CostItemQuery
- func (q *CostItemQuery) WithCount(relations ...string) *CostItemQuery
- func (q *CostItemQuery) WithExists(relation string) *CostItemQuery
- func (q *CostItemQuery) WithMax(relation, column string) *CostItemQuery
- func (q *CostItemQuery) WithMin(relation, column string) *CostItemQuery
- func (q *CostItemQuery) WithSum(relation, column string) *CostItemQuery
- func (q *CostItemQuery) Without(relations ...string) *CostItemQuery
- func (q *CostItemQuery) WithoutGlobalScope(identifier string) *CostItemQuery
- func (q *CostItemQuery) WithoutGlobalScopes(identifiers ...string) *CostItemQuery
- type CostRequest
- type CostRow
- type CostView
- type CreateRequest
- type DashboardPageData
- type Day
- type EntriesQuery
- type Entry
- type EntryCollection
- func (c EntryCollection) Contains(key any) bool
- func (c EntryCollection) Except(keys ...any) EntryCollection
- func (c EntryCollection) Find(key any) *Entry
- func (c EntryCollection) FindOrFail(key any) (*Entry, error)
- func (c EntryCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (EntryCollection, error)
- func (c EntryCollection) Load(ctx context.Context, g auth.Grant, relations ...string) error
- func (c EntryCollection) LoadCount(ctx context.Context, g auth.Grant, relations ...string) error
- func (c EntryCollection) LoadMissing(ctx context.Context, g auth.Grant, relations ...string) error
- func (c EntryCollection) ModelKeys() []any
- func (c EntryCollection) Only(keys ...any) EntryCollection
- func (c EntryCollection) Pluck(column string) []any
- func (c EntryCollection) Rows() model.Rows
- func (c EntryCollection) ToArray() []map[string]any
- func (c EntryCollection) Unique() EntryCollection
- type EntryKind
- type EntryQuery
- func (q *EntryQuery) AddSelect(columns ...any) *EntryQuery
- func (q *EntryQuery) Avg(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *EntryQuery) Base() *model.Builder
- func (q *EntryQuery) Chunk(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *EntryQuery) Clone() *EntryQuery
- func (q *EntryQuery) Count(ctx context.Context, g auth.Grant, columns ...any) (int64, error)
- func (q *EntryQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*Entry, error)
- func (q *EntryQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*Entry, error]
- func (q *EntryQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, ...) (EntryCollection, *pagination.CursorPage, error)
- func (q *EntryQuery) Decrement(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *EntryQuery) Delete(ctx context.Context, g auth.Grant) (int64, error)
- func (q *EntryQuery) DoesntExist(ctx context.Context, g auth.Grant) (bool, error)
- func (q *EntryQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *EntryQuery
- func (q *EntryQuery) Each(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *EntryQuery) Exists(ctx context.Context, g auth.Grant) (bool, error)
- func (q *EntryQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*Entry, error)
- func (q *EntryQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (EntryCollection, error)
- func (q *EntryQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*Entry, error)
- func (q *EntryQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*Entry, error)
- func (q *EntryQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*Entry, error)
- func (q *EntryQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Entry, error)
- func (q *EntryQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*Entry, error)
- func (q *EntryQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Entry, error)
- func (q *EntryQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*Entry, error)
- func (q *EntryQuery) ForPage(page, perPage int) *EntryQuery
- func (q *EntryQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*Entry, error)
- func (q *EntryQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (EntryCollection, error)
- func (q *EntryQuery) GroupBy(groups ...any) *EntryQuery
- func (q *EntryQuery) Has(relation, operator string, count int, boolean string, ...) *EntryQuery
- func (q *EntryQuery) Increment(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *EntryQuery) Insert(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *EntryQuery) InsertOrIgnore(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *EntryQuery) Join(table any, first any, args ...any) *EntryQuery
- func (q *EntryQuery) Latest(column ...string) *EntryQuery
- func (q *EntryQuery) Limit(value int) *EntryQuery
- func (q *EntryQuery) Max(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *EntryQuery) Min(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *EntryQuery) New() (*Entry, error)
- func (q *EntryQuery) Offset(value int) *EntryQuery
- func (q *EntryQuery) Oldest(column ...string) *EntryQuery
- func (q *EntryQuery) OrDoesntHave(relation string) *EntryQuery
- func (q *EntryQuery) OrHas(relation, operator string, count int) *EntryQuery
- func (q *EntryQuery) OrWhere(column any, args ...any) *EntryQuery
- func (q *EntryQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *EntryQuery
- func (q *EntryQuery) OrWhereHas(relation string, callback func(*query.Builder)) *EntryQuery
- func (q *EntryQuery) OrWhereNot(column any, args ...any) *EntryQuery
- func (q *EntryQuery) OrWhereRelation(relation string, column any, args ...any) *EntryQuery
- func (q *EntryQuery) OrderBy(column any, direction ...string) *EntryQuery
- func (q *EntryQuery) OrderByDesc(column any) *EntryQuery
- func (q *EntryQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (EntryCollection, *pagination.LengthAwarePage, error)
- func (q *EntryQuery) Pluck(ctx context.Context, g auth.Grant, column string) ([]any, error)
- func (q *EntryQuery) Select(columns ...any) *EntryQuery
- func (q *EntryQuery) SelectRaw(expression string, bindings ...any) *EntryQuery
- func (q *EntryQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (EntryCollection, *pagination.Page, error)
- func (q *EntryQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*Entry, error)
- func (q *EntryQuery) SoleValue(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *EntryQuery) Sum(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *EntryQuery) Touch(ctx context.Context, g auth.Grant, column ...string) (int64, error)
- func (q *EntryQuery) Update(ctx context.Context, g auth.Grant, values map[string]any) (int64, error)
- func (q *EntryQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Entry, error)
- func (q *EntryQuery) Upsert(ctx context.Context, g auth.Grant, values []map[string]any, ...) (int64, error)
- func (q *EntryQuery) Value(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *EntryQuery) ValueOrFail(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *EntryQuery) Where(column any, args ...any) *EntryQuery
- func (q *EntryQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *EntryQuery
- func (q *EntryQuery) WhereBetween(column any, from, to any) *EntryQuery
- func (q *EntryQuery) WhereColumn(first any, args ...any) *EntryQuery
- func (q *EntryQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *EntryQuery
- func (q *EntryQuery) WhereExists(callback func(*query.Builder)) *EntryQuery
- func (q *EntryQuery) WhereHas(relation string, callback func(*query.Builder)) *EntryQuery
- func (q *EntryQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *EntryQuery
- func (q *EntryQuery) WhereIn(column any, values []any) *EntryQuery
- func (q *EntryQuery) WhereKey(id any) *EntryQuery
- func (q *EntryQuery) WhereNot(column any, args ...any) *EntryQuery
- func (q *EntryQuery) WhereNotExists(callback func(*query.Builder)) *EntryQuery
- func (q *EntryQuery) WhereNotIn(column any, values []any) *EntryQuery
- func (q *EntryQuery) WhereNotNull(columns ...any) *EntryQuery
- func (q *EntryQuery) WhereNull(columns ...any) *EntryQuery
- func (q *EntryQuery) WhereRelation(relation string, column any, args ...any) *EntryQuery
- func (q *EntryQuery) With(relations ...string) *EntryQuery
- func (q *EntryQuery) WithAvg(relation, column string) *EntryQuery
- func (q *EntryQuery) WithCount(relations ...string) *EntryQuery
- func (q *EntryQuery) WithExists(relation string) *EntryQuery
- func (q *EntryQuery) WithMax(relation, column string) *EntryQuery
- func (q *EntryQuery) WithMin(relation, column string) *EntryQuery
- func (q *EntryQuery) WithSum(relation, column string) *EntryQuery
- func (q *EntryQuery) Without(relations ...string) *EntryQuery
- func (q *EntryQuery) WithoutGlobalScope(identifier string) *EntryQuery
- func (q *EntryQuery) WithoutGlobalScopes(identifiers ...string) *EntryQuery
- type EntryRequest
- type EntryRow
- type EntrySource
- type Figures
- type Flag
- type FormState
- type Investor
- func (i Investor) DisplayName() string
- func (row *Investor) Fresh(ctx context.Context, g auth.Grant, with ...string) (*Investor, error)
- func (i Investor) IsActive() bool
- func (i *Investor) Reactivate(now time.Time) error
- func (row *Investor) Replicate(except ...string) (*Investor, error)
- func (i *Investor) Suspend(now time.Time) error
- type InvestorCollection
- func (c InvestorCollection) Contains(key any) bool
- func (c InvestorCollection) Except(keys ...any) InvestorCollection
- func (c InvestorCollection) Find(key any) *Investor
- func (c InvestorCollection) FindOrFail(key any) (*Investor, error)
- func (c InvestorCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (InvestorCollection, error)
- func (c InvestorCollection) Load(ctx context.Context, g auth.Grant, relations ...string) error
- func (c InvestorCollection) LoadCount(ctx context.Context, g auth.Grant, relations ...string) error
- func (c InvestorCollection) LoadMissing(ctx context.Context, g auth.Grant, relations ...string) error
- func (c InvestorCollection) ModelKeys() []any
- func (c InvestorCollection) Only(keys ...any) InvestorCollection
- func (c InvestorCollection) Pluck(column string) []any
- func (c InvestorCollection) Rows() model.Rows
- func (c InvestorCollection) ToArray() []map[string]any
- func (c InvestorCollection) Unique() InvestorCollection
- type InvestorPolicy
- type InvestorQuery
- func (q *InvestorQuery) AddSelect(columns ...any) *InvestorQuery
- func (q *InvestorQuery) Avg(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvestorQuery) Base() *model.Builder
- func (q *InvestorQuery) Chunk(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *InvestorQuery) Clone() *InvestorQuery
- func (q *InvestorQuery) Count(ctx context.Context, g auth.Grant, columns ...any) (int64, error)
- func (q *InvestorQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*Investor, error)
- func (q *InvestorQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*Investor, error]
- func (q *InvestorQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, ...) (InvestorCollection, *pagination.CursorPage, error)
- func (q *InvestorQuery) Decrement(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *InvestorQuery) Delete(ctx context.Context, g auth.Grant) (int64, error)
- func (q *InvestorQuery) DoesntExist(ctx context.Context, g auth.Grant) (bool, error)
- func (q *InvestorQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *InvestorQuery
- func (q *InvestorQuery) Each(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *InvestorQuery) Exists(ctx context.Context, g auth.Grant) (bool, error)
- func (q *InvestorQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*Investor, error)
- func (q *InvestorQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (InvestorCollection, error)
- func (q *InvestorQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*Investor, error)
- func (q *InvestorQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*Investor, error)
- func (q *InvestorQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*Investor, error)
- func (q *InvestorQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Investor, error)
- func (q *InvestorQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*Investor, error)
- func (q *InvestorQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Investor, error)
- func (q *InvestorQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*Investor, error)
- func (q *InvestorQuery) ForPage(page, perPage int) *InvestorQuery
- func (q *InvestorQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*Investor, error)
- func (q *InvestorQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (InvestorCollection, error)
- func (q *InvestorQuery) GroupBy(groups ...any) *InvestorQuery
- func (q *InvestorQuery) Has(relation, operator string, count int, boolean string, ...) *InvestorQuery
- func (q *InvestorQuery) Increment(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *InvestorQuery) Insert(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *InvestorQuery) InsertOrIgnore(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *InvestorQuery) Join(table any, first any, args ...any) *InvestorQuery
- func (q *InvestorQuery) Latest(column ...string) *InvestorQuery
- func (q *InvestorQuery) Limit(value int) *InvestorQuery
- func (q *InvestorQuery) Max(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvestorQuery) Min(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvestorQuery) New() (*Investor, error)
- func (q *InvestorQuery) Offset(value int) *InvestorQuery
- func (q *InvestorQuery) Oldest(column ...string) *InvestorQuery
- func (q *InvestorQuery) OrDoesntHave(relation string) *InvestorQuery
- func (q *InvestorQuery) OrHas(relation, operator string, count int) *InvestorQuery
- func (q *InvestorQuery) OrWhere(column any, args ...any) *InvestorQuery
- func (q *InvestorQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *InvestorQuery
- func (q *InvestorQuery) OrWhereHas(relation string, callback func(*query.Builder)) *InvestorQuery
- func (q *InvestorQuery) OrWhereNot(column any, args ...any) *InvestorQuery
- func (q *InvestorQuery) OrWhereRelation(relation string, column any, args ...any) *InvestorQuery
- func (q *InvestorQuery) OrderBy(column any, direction ...string) *InvestorQuery
- func (q *InvestorQuery) OrderByDesc(column any) *InvestorQuery
- func (q *InvestorQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (InvestorCollection, *pagination.LengthAwarePage, error)
- func (q *InvestorQuery) Pluck(ctx context.Context, g auth.Grant, column string) ([]any, error)
- func (q *InvestorQuery) Select(columns ...any) *InvestorQuery
- func (q *InvestorQuery) SelectRaw(expression string, bindings ...any) *InvestorQuery
- func (q *InvestorQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (InvestorCollection, *pagination.Page, error)
- func (q *InvestorQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*Investor, error)
- func (q *InvestorQuery) SoleValue(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *InvestorQuery) Sum(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvestorQuery) Touch(ctx context.Context, g auth.Grant, column ...string) (int64, error)
- func (q *InvestorQuery) Update(ctx context.Context, g auth.Grant, values map[string]any) (int64, error)
- func (q *InvestorQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Investor, error)
- func (q *InvestorQuery) Upsert(ctx context.Context, g auth.Grant, values []map[string]any, ...) (int64, error)
- func (q *InvestorQuery) Value(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *InvestorQuery) ValueOrFail(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *InvestorQuery) Where(column any, args ...any) *InvestorQuery
- func (q *InvestorQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *InvestorQuery
- func (q *InvestorQuery) WhereBetween(column any, from, to any) *InvestorQuery
- func (q *InvestorQuery) WhereColumn(first any, args ...any) *InvestorQuery
- func (q *InvestorQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *InvestorQuery
- func (q *InvestorQuery) WhereExists(callback func(*query.Builder)) *InvestorQuery
- func (q *InvestorQuery) WhereHas(relation string, callback func(*query.Builder)) *InvestorQuery
- func (q *InvestorQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *InvestorQuery
- func (q *InvestorQuery) WhereIn(column any, values []any) *InvestorQuery
- func (q *InvestorQuery) WhereKey(id any) *InvestorQuery
- func (q *InvestorQuery) WhereNot(column any, args ...any) *InvestorQuery
- func (q *InvestorQuery) WhereNotExists(callback func(*query.Builder)) *InvestorQuery
- func (q *InvestorQuery) WhereNotIn(column any, values []any) *InvestorQuery
- func (q *InvestorQuery) WhereNotNull(columns ...any) *InvestorQuery
- func (q *InvestorQuery) WhereNull(columns ...any) *InvestorQuery
- func (q *InvestorQuery) WhereRelation(relation string, column any, args ...any) *InvestorQuery
- func (q *InvestorQuery) With(relations ...string) *InvestorQuery
- func (q *InvestorQuery) WithAvg(relation, column string) *InvestorQuery
- func (q *InvestorQuery) WithCount(relations ...string) *InvestorQuery
- func (q *InvestorQuery) WithExists(relation string) *InvestorQuery
- func (q *InvestorQuery) WithMax(relation, column string) *InvestorQuery
- func (q *InvestorQuery) WithMin(relation, column string) *InvestorQuery
- func (q *InvestorQuery) WithSum(relation, column string) *InvestorQuery
- func (q *InvestorQuery) Without(relations ...string) *InvestorQuery
- func (q *InvestorQuery) WithoutGlobalScope(identifier string) *InvestorQuery
- func (q *InvestorQuery) WithoutGlobalScopes(identifiers ...string) *InvestorQuery
- type InvestorRow
- type InvestorService
- func (s *InvestorService) AddBankAccount(ctx context.Context, actor security.Subject, in BankAccountRequest) (*wallet.PayoutAccount, error)
- func (s *InvestorService) AddPixAccount(ctx context.Context, actor security.Subject, keyType, key string) (*wallet.PayoutAccount, error)
- func (s *InvestorService) AdminCosts(ctx context.Context, actor security.Subject) ([]CostView, error)
- func (s *InvestorService) AmendContract(ctx context.Context, actor security.Subject, contractID string, ...) (*Contract, error)
- func (s *InvestorService) AnnualReport(ctx context.Context, actor security.Subject, investorID string, year int, ...) error
- func (s *InvestorService) Close(ctx context.Context, actor security.Subject, contractID string, asOf Day) (*Invoice, error)
- func (s *InvestorService) CloseDue(ctx context.Context, actor security.Subject, asOf Day) ([]*Invoice, map[string]error, error)
- func (s *InvestorService) ContractFile(ctx context.Context, actor security.Subject, contractID string) (*Contract, filesystem.File, error)
- func (s *InvestorService) Costs(ctx context.Context, actor security.Subject) ([]CostView, error)
- func (s *InvestorService) Create(ctx context.Context, actor security.Subject, in CreateRequest) (*Investor, error)
- func (s *InvestorService) CreateContract(ctx context.Context, actor security.Subject, investorID string, ...) (*Contract, error)
- func (s *InvestorService) CreateCost(ctx context.Context, actor security.Subject, in CostRequest) (*CostItem, error)
- func (s *InvestorService) EndCost(ctx context.Context, actor security.Subject, costID, lastDay string) (*CostItem, error)
- func (s *InvestorService) EntriesPage(ctx context.Context, actor security.Subject, q EntriesQuery) ([]*Entry, int, error)
- func (s *InvestorService) Find(ctx context.Context, actor security.Subject, id string) (*Investor, error)
- func (s *InvestorService) InvestorContracts(ctx context.Context, actor security.Subject, investorID string) ([]ContractResource, error)
- func (s *InvestorService) InvoiceReceipt(ctx context.Context, actor security.Subject, invoiceID string) (*wallet.WithdrawalRequest, filesystem.File, error)
- func (s *InvestorService) InvoiceViews(ctx context.Context, actor security.Subject, investorID string) ([]InvoiceView, error)
- func (s *InvestorService) Invoices(ctx context.Context, actor security.Subject, investorID string) ([]*Invoice, error)
- func (s *InvestorService) List(ctx context.Context, actor security.Subject, q data.Query) ([]*Investor, error)
- func (s *InvestorService) Mine(ctx context.Context, actor security.Subject) (*Investor, error)
- func (s *InvestorService) MonthlyReport(ctx context.Context, actor security.Subject, investorID string, ...) error
- func (s *InvestorService) PayInvestorWithdrawal(ctx context.Context, actor security.Subject, in wallet.PaymentInput, ...) (*wallet.WithdrawalRequest, error)
- func (s *InvestorService) PayoutAccounts(ctx context.Context, actor security.Subject, investorID string) ([]*wallet.PayoutAccount, error)
- func (s *InvestorService) ProjectionOf(ctx context.Context, actor security.Subject, contractID string) (*Projection, error)
- func (s *InvestorService) RecordEntry(ctx context.Context, actor security.Subject, in EntryRequest) (*Entry, error)
- func (s *InvestorService) RecordManualEntry(ctx context.Context, actor security.Subject, in EntryRequest) (*Entry, error)
- func (s *InvestorService) RejectInvestorWithdrawal(ctx context.Context, actor security.Subject, requestID, reason string) (*wallet.WithdrawalRequest, error)
- func (s *InvestorService) ReverseEntry(ctx context.Context, actor security.Subject, entryID, reason string) (*Entry, error)
- func (s *InvestorService) SetActive(ctx context.Context, actor security.Subject, id string, active bool) (*Investor, error)
- func (s *InvestorService) StartPaying(ctx context.Context, actor security.Subject, requestID string) (*wallet.WithdrawalRequest, error)
- func (s *InvestorService) StatementOf(ctx context.Context, actor security.Subject, contractID string, ...) (*Statement, error)
- func (s *InvestorService) Update(ctx context.Context, actor security.Subject, id string, in UpdateRequest) (*Investor, error)
- func (s *InvestorService) WithdrawInvoice(ctx context.Context, actor security.Subject, invoiceID, accountID string) (*InvoiceView, error)
- func (s *InvestorService) Withdrawals(ctx context.Context, actor security.Subject, status wallet.WithdrawalStatus) ([]InvestorWithdrawal, error)
- type InvestorStatus
- type InvestorWithdrawal
- type Invoice
- type InvoiceCollection
- func (c InvoiceCollection) Contains(key any) bool
- func (c InvoiceCollection) Except(keys ...any) InvoiceCollection
- func (c InvoiceCollection) Find(key any) *Invoice
- func (c InvoiceCollection) FindOrFail(key any) (*Invoice, error)
- func (c InvoiceCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (InvoiceCollection, error)
- func (c InvoiceCollection) Load(ctx context.Context, g auth.Grant, relations ...string) error
- func (c InvoiceCollection) LoadCount(ctx context.Context, g auth.Grant, relations ...string) error
- func (c InvoiceCollection) LoadMissing(ctx context.Context, g auth.Grant, relations ...string) error
- func (c InvoiceCollection) ModelKeys() []any
- func (c InvoiceCollection) Only(keys ...any) InvoiceCollection
- func (c InvoiceCollection) Pluck(column string) []any
- func (c InvoiceCollection) Rows() model.Rows
- func (c InvoiceCollection) ToArray() []map[string]any
- func (c InvoiceCollection) Unique() InvoiceCollection
- type InvoiceEntry
- type InvoiceEntryCollection
- func (c InvoiceEntryCollection) Contains(key any) bool
- func (c InvoiceEntryCollection) Except(keys ...any) InvoiceEntryCollection
- func (c InvoiceEntryCollection) Find(key any) *InvoiceEntry
- func (c InvoiceEntryCollection) FindOrFail(key any) (*InvoiceEntry, error)
- func (c InvoiceEntryCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (InvoiceEntryCollection, error)
- func (c InvoiceEntryCollection) Load(ctx context.Context, g auth.Grant, relations ...string) error
- func (c InvoiceEntryCollection) LoadCount(ctx context.Context, g auth.Grant, relations ...string) error
- func (c InvoiceEntryCollection) LoadMissing(ctx context.Context, g auth.Grant, relations ...string) error
- func (c InvoiceEntryCollection) ModelKeys() []any
- func (c InvoiceEntryCollection) Only(keys ...any) InvoiceEntryCollection
- func (c InvoiceEntryCollection) Pluck(column string) []any
- func (c InvoiceEntryCollection) Rows() model.Rows
- func (c InvoiceEntryCollection) ToArray() []map[string]any
- func (c InvoiceEntryCollection) Unique() InvoiceEntryCollection
- type InvoiceEntryQuery
- func (q *InvoiceEntryQuery) AddSelect(columns ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Avg(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvoiceEntryQuery) Base() *model.Builder
- func (q *InvoiceEntryQuery) Chunk(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *InvoiceEntryQuery) Clone() *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Count(ctx context.Context, g auth.Grant, columns ...any) (int64, error)
- func (q *InvoiceEntryQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*InvoiceEntry, error]
- func (q *InvoiceEntryQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, ...) (InvoiceEntryCollection, *pagination.CursorPage, error)
- func (q *InvoiceEntryQuery) Decrement(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *InvoiceEntryQuery) Delete(ctx context.Context, g auth.Grant) (int64, error)
- func (q *InvoiceEntryQuery) DoesntExist(ctx context.Context, g auth.Grant) (bool, error)
- func (q *InvoiceEntryQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Each(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *InvoiceEntryQuery) Exists(ctx context.Context, g auth.Grant) (bool, error)
- func (q *InvoiceEntryQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (InvoiceEntryCollection, error)
- func (q *InvoiceEntryQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) ForPage(page, perPage int) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (InvoiceEntryCollection, error)
- func (q *InvoiceEntryQuery) GroupBy(groups ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Has(relation, operator string, count int, boolean string, ...) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Increment(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *InvoiceEntryQuery) Insert(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *InvoiceEntryQuery) InsertOrIgnore(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *InvoiceEntryQuery) Join(table any, first any, args ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Latest(column ...string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Limit(value int) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Max(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvoiceEntryQuery) Min(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvoiceEntryQuery) New() (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) Offset(value int) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Oldest(column ...string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) OrDoesntHave(relation string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) OrHas(relation, operator string, count int) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) OrWhere(column any, args ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) OrWhereHas(relation string, callback func(*query.Builder)) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) OrWhereNot(column any, args ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) OrWhereRelation(relation string, column any, args ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) OrderBy(column any, direction ...string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) OrderByDesc(column any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (InvoiceEntryCollection, *pagination.LengthAwarePage, error)
- func (q *InvoiceEntryQuery) Pluck(ctx context.Context, g auth.Grant, column string) ([]any, error)
- func (q *InvoiceEntryQuery) Select(columns ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) SelectRaw(expression string, bindings ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (InvoiceEntryCollection, *pagination.Page, error)
- func (q *InvoiceEntryQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) SoleValue(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *InvoiceEntryQuery) Sum(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvoiceEntryQuery) Touch(ctx context.Context, g auth.Grant, column ...string) (int64, error)
- func (q *InvoiceEntryQuery) Update(ctx context.Context, g auth.Grant, values map[string]any) (int64, error)
- func (q *InvoiceEntryQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*InvoiceEntry, error)
- func (q *InvoiceEntryQuery) Upsert(ctx context.Context, g auth.Grant, values []map[string]any, ...) (int64, error)
- func (q *InvoiceEntryQuery) Value(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *InvoiceEntryQuery) ValueOrFail(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *InvoiceEntryQuery) Where(column any, args ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereBetween(column any, from, to any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereColumn(first any, args ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereExists(callback func(*query.Builder)) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereHas(relation string, callback func(*query.Builder)) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereIn(column any, values []any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereKey(id any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereNot(column any, args ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereNotExists(callback func(*query.Builder)) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereNotIn(column any, values []any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereNotNull(columns ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereNull(columns ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WhereRelation(relation string, column any, args ...any) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) With(relations ...string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WithAvg(relation, column string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WithCount(relations ...string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WithExists(relation string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WithMax(relation, column string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WithMin(relation, column string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WithSum(relation, column string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) Without(relations ...string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WithoutGlobalScope(identifier string) *InvoiceEntryQuery
- func (q *InvoiceEntryQuery) WithoutGlobalScopes(identifiers ...string) *InvoiceEntryQuery
- type InvoiceQuery
- func (q *InvoiceQuery) AddSelect(columns ...any) *InvoiceQuery
- func (q *InvoiceQuery) Avg(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvoiceQuery) Base() *model.Builder
- func (q *InvoiceQuery) Chunk(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *InvoiceQuery) Clone() *InvoiceQuery
- func (q *InvoiceQuery) Count(ctx context.Context, g auth.Grant, columns ...any) (int64, error)
- func (q *InvoiceQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*Invoice, error)
- func (q *InvoiceQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*Invoice, error]
- func (q *InvoiceQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, ...) (InvoiceCollection, *pagination.CursorPage, error)
- func (q *InvoiceQuery) Decrement(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *InvoiceQuery) Delete(ctx context.Context, g auth.Grant) (int64, error)
- func (q *InvoiceQuery) DoesntExist(ctx context.Context, g auth.Grant) (bool, error)
- func (q *InvoiceQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *InvoiceQuery
- func (q *InvoiceQuery) Each(ctx context.Context, g auth.Grant, count int, ...) error
- func (q *InvoiceQuery) Exists(ctx context.Context, g auth.Grant) (bool, error)
- func (q *InvoiceQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*Invoice, error)
- func (q *InvoiceQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (InvoiceCollection, error)
- func (q *InvoiceQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*Invoice, error)
- func (q *InvoiceQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*Invoice, error)
- func (q *InvoiceQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*Invoice, error)
- func (q *InvoiceQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Invoice, error)
- func (q *InvoiceQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*Invoice, error)
- func (q *InvoiceQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Invoice, error)
- func (q *InvoiceQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*Invoice, error)
- func (q *InvoiceQuery) ForPage(page, perPage int) *InvoiceQuery
- func (q *InvoiceQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*Invoice, error)
- func (q *InvoiceQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (InvoiceCollection, error)
- func (q *InvoiceQuery) GroupBy(groups ...any) *InvoiceQuery
- func (q *InvoiceQuery) Has(relation, operator string, count int, boolean string, ...) *InvoiceQuery
- func (q *InvoiceQuery) Increment(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error)
- func (q *InvoiceQuery) Insert(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *InvoiceQuery) InsertOrIgnore(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error)
- func (q *InvoiceQuery) Join(table any, first any, args ...any) *InvoiceQuery
- func (q *InvoiceQuery) Latest(column ...string) *InvoiceQuery
- func (q *InvoiceQuery) Limit(value int) *InvoiceQuery
- func (q *InvoiceQuery) Max(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvoiceQuery) Min(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvoiceQuery) New() (*Invoice, error)
- func (q *InvoiceQuery) Offset(value int) *InvoiceQuery
- func (q *InvoiceQuery) Oldest(column ...string) *InvoiceQuery
- func (q *InvoiceQuery) OrDoesntHave(relation string) *InvoiceQuery
- func (q *InvoiceQuery) OrHas(relation, operator string, count int) *InvoiceQuery
- func (q *InvoiceQuery) OrWhere(column any, args ...any) *InvoiceQuery
- func (q *InvoiceQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *InvoiceQuery
- func (q *InvoiceQuery) OrWhereHas(relation string, callback func(*query.Builder)) *InvoiceQuery
- func (q *InvoiceQuery) OrWhereNot(column any, args ...any) *InvoiceQuery
- func (q *InvoiceQuery) OrWhereRelation(relation string, column any, args ...any) *InvoiceQuery
- func (q *InvoiceQuery) OrderBy(column any, direction ...string) *InvoiceQuery
- func (q *InvoiceQuery) OrderByDesc(column any) *InvoiceQuery
- func (q *InvoiceQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (InvoiceCollection, *pagination.LengthAwarePage, error)
- func (q *InvoiceQuery) Pluck(ctx context.Context, g auth.Grant, column string) ([]any, error)
- func (q *InvoiceQuery) Select(columns ...any) *InvoiceQuery
- func (q *InvoiceQuery) SelectRaw(expression string, bindings ...any) *InvoiceQuery
- func (q *InvoiceQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (InvoiceCollection, *pagination.Page, error)
- func (q *InvoiceQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*Invoice, error)
- func (q *InvoiceQuery) SoleValue(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *InvoiceQuery) Sum(ctx context.Context, g auth.Grant, column any) (any, error)
- func (q *InvoiceQuery) Touch(ctx context.Context, g auth.Grant, column ...string) (int64, error)
- func (q *InvoiceQuery) Update(ctx context.Context, g auth.Grant, values map[string]any) (int64, error)
- func (q *InvoiceQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Invoice, error)
- func (q *InvoiceQuery) Upsert(ctx context.Context, g auth.Grant, values []map[string]any, ...) (int64, error)
- func (q *InvoiceQuery) Value(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *InvoiceQuery) ValueOrFail(ctx context.Context, g auth.Grant, column string) (any, error)
- func (q *InvoiceQuery) Where(column any, args ...any) *InvoiceQuery
- func (q *InvoiceQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *InvoiceQuery
- func (q *InvoiceQuery) WhereBetween(column any, from, to any) *InvoiceQuery
- func (q *InvoiceQuery) WhereColumn(first any, args ...any) *InvoiceQuery
- func (q *InvoiceQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *InvoiceQuery
- func (q *InvoiceQuery) WhereExists(callback func(*query.Builder)) *InvoiceQuery
- func (q *InvoiceQuery) WhereHas(relation string, callback func(*query.Builder)) *InvoiceQuery
- func (q *InvoiceQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *InvoiceQuery
- func (q *InvoiceQuery) WhereIn(column any, values []any) *InvoiceQuery
- func (q *InvoiceQuery) WhereKey(id any) *InvoiceQuery
- func (q *InvoiceQuery) WhereNot(column any, args ...any) *InvoiceQuery
- func (q *InvoiceQuery) WhereNotExists(callback func(*query.Builder)) *InvoiceQuery
- func (q *InvoiceQuery) WhereNotIn(column any, values []any) *InvoiceQuery
- func (q *InvoiceQuery) WhereNotNull(columns ...any) *InvoiceQuery
- func (q *InvoiceQuery) WhereNull(columns ...any) *InvoiceQuery
- func (q *InvoiceQuery) WhereRelation(relation string, column any, args ...any) *InvoiceQuery
- func (q *InvoiceQuery) With(relations ...string) *InvoiceQuery
- func (q *InvoiceQuery) WithAvg(relation, column string) *InvoiceQuery
- func (q *InvoiceQuery) WithCount(relations ...string) *InvoiceQuery
- func (q *InvoiceQuery) WithExists(relation string) *InvoiceQuery
- func (q *InvoiceQuery) WithMax(relation, column string) *InvoiceQuery
- func (q *InvoiceQuery) WithMin(relation, column string) *InvoiceQuery
- func (q *InvoiceQuery) WithSum(relation, column string) *InvoiceQuery
- func (q *InvoiceQuery) Without(relations ...string) *InvoiceQuery
- func (q *InvoiceQuery) WithoutGlobalScope(identifier string) *InvoiceQuery
- func (q *InvoiceQuery) WithoutGlobalScopes(identifiers ...string) *InvoiceQuery
- type InvoiceRow
- type InvoiceStatus
- type InvoiceView
- type Labels
- func (l Labels) Errors(errs validation.Errors) validation.Errors
- func (l Labels) Field(name string) string
- func (l Labels) Kind(k EntryKind) string
- func (l Labels) Message(msg string) string
- func (l Labels) Month(month int) string
- func (l Labels) Status(s InvoiceStatus) string
- func (l Labels) Summary(errs validation.Errors) []string
- func (l Labels) T(key string) string
- type Module
- func (m *Module) AdminRoutes(r *fhttp.Router)
- func (m *Module) Boot(context.Context) error
- func (m *Module) InvestorRoutes(r *fhttp.Router)
- func (m *Module) Labels(locale string) Labels
- func (m *Module) Migrations() []foundation.Migration
- func (m *Module) Name() string
- func (m *Module) Publishes() []foundation.Publication
- func (m *Module) Routes(r *fhttp.Router)
- func (m *Module) Service() *InvestorService
- func (m *Module) URLs() URLs
- type Paths
- type Payer
- type PersonKind
- type ProjectedCost
- type ProjectedCostRow
- type Projection
- type ProjectionPageData
- type Recurrence
- type ReportLink
- type Resource
- type Scope
- type ScopedCost
- type Screen
- func (s Screen) AdminNav(current string) template.HTML
- func (s Screen) All() []string
- func (s Screen) BankAccountTypeOptions() []components.SelectOption
- func (s Screen) CellForm(action, label, variant string, inputs ...CellInput) template.HTML
- func (s Screen) Chrome() any
- func (s Screen) ErrorSummary() []string
- func (s Screen) FieldErrors(name string) []string
- func (s Screen) Form() FormState
- func (s Screen) HasErrors() bool
- func (s Screen) KindOptions() []components.SelectOption
- func (s Screen) LogValue() slog.Value
- func (s Screen) ManualKindOptions() []components.SelectOption
- func (s Screen) MarshalJSON() ([]byte, error)
- func (s Screen) PayForm(action string) template.HTML
- func (s Screen) PersonOptions() []components.SelectOption
- func (s Screen) PixKeyOptions() []components.SelectOption
- func (s Screen) RecurrenceOptions() []components.SelectOption
- func (s Screen) SearchLabel(table string) string
- func (s Screen) TableLines() components.DataTableLines
- func (s Screen) WithdrawForm(action string, accounts []AccountOption) template.HTML
- func (s Screen) WithdrawalStatusOptions() []components.SelectOption
- type Statement
- type StatementFilter
- type StatementLine
- type StatementPageData
- type StatementRow
- type URLs
- func (u URLs) AdminCosts() string
- func (u URLs) AdminPrefix() string
- func (u URLs) Amend(contractID string) string
- func (u URLs) Close(contractID string) string
- func (u URLs) CloseDue() string
- func (u URLs) ContractFile(id string) string
- func (u URLs) Costs() string
- func (u URLs) EndCost(id string) string
- func (u URLs) Entries() string
- func (u URLs) Investor(id string) string
- func (u URLs) InvestorContracts(id string) string
- func (u URLs) InvestorInvoices(id string) string
- func (u URLs) InvestorReports(id string) string
- func (u URLs) Investors() string
- func (u URLs) Me() string
- func (u URLs) MyContracts() string
- func (u URLs) MyInvoices() string
- func (u URLs) MyReports() string
- func (u URLs) Pay(id string) string
- func (u URLs) PayoutAccounts() string
- func (u URLs) Prefix() string
- func (u URLs) Process(id string) string
- func (u URLs) Projection(id string) string
- func (u URLs) Receipt(invoiceID string) string
- func (u URLs) Reject(id string) string
- func (u URLs) Reverse(id string) string
- func (u URLs) Statement(id string) string
- func (u URLs) Suspension(id string) string
- func (u URLs) Withdraw(invoiceID string) string
- func (u URLs) Withdrawals() string
- type UpdateRequest
- type WithdrawalRow
Constants ¶
const ( EventInvestorCreated = "investor.created" EventInvestorUpdated = "investor.updated" EventInvestorSuspended = "investor.suspended" EventInvestorReactivated = "investor.reactivated" EventContractCreated = "contract.created" EventContractAmended = "contract.amended" EventEntryRecorded = "entry.recorded" EventEntryReversed = "entry.reversed" EventCostCreated = "cost.created" EventCostEnded = "cost.ended" EventPeriodClosed = "period.closed" EventPayoutAccountAdded = "payout_account.added" EventWithdrawalRequested = "withdrawal.requested" EventWithdrawalTaken = "withdrawal.processing" EventWithdrawalPaid = "withdrawal.paid" EventWithdrawalRejected = "withdrawal.rejected" )
The events this package records, one per act that changes something. The subject of each entry is the record the act was on, by kind and key.
const ( // DefaultPrefix is where the routes are mounted when Config leaves Prefix // empty. DefaultPrefix = "/investor" // DefaultPageSize is how many records one page answers with when Config // leaves PageSize at zero. DefaultPageSize = 25 // MaxPageSize is the ceiling PageSize is refused above. A page nobody // bounded is a page that reads the whole table on the day the table is // large. MaxPageSize = 200 )
The defaults for the optional settings. They are constants rather than literals inside Config.withDefaults, so the value a reader finds here is the value the package uses.
const ( // InvestorsManage is registering, changing and suspending investors, and // keeping their contracts. InvestorsManage security.Action = "investor.investors.manage" // EntriesManage is recording entries by hand, reversing them and closing a // contract's period. EntriesManage security.Action = "investor.entries.manage" // CostsManage is declaring the costs of the system. CostsManage security.Action = "investor.costs.manage" // DashboardView is reading an investor's statement, costs and projection. DashboardView security.Action = "investor.dashboard.view" // ContractView is reading and downloading an investor's own contract. ContractView security.Action = "investor.contract.view" // ReportsView is reading an investor's invoices and income reports. ReportsView security.Action = "investor.reports.view" // AdminAction is being this package's admin, held as an action: what an // application whose permissions arandu-permission administers puts in a // group, so the people of that group are the admin without a role // written on their accounts. It opens what AdminRole opens, and nothing // more. AdminAction security.Action = "investor.admin" )
The actions of this package. Constants rather than strings at the call site: a typo in an action name would silently authorize nothing, or worse, everything.
They carry the package in the name because an application registers many packages, and the name of an action shows up in logs and in audit trails where "view" on its own says nothing about what was viewed.
const ( PayoutPix = "pix" PayoutBank = "bank" )
The kinds of payout account an investor declares, as arandu-wallet keeps them.
const ( // TranslationGroup is the file every key of this package lives in, and the // prefix of every key: "investor.screen.dashboard_title". TranslationGroup = "investor" // FallbackLocale answers a request that negotiated no locale, when // Config.Locale names none either, and every line a locale does not have. // It is English, as in the other hyz-is modules; an application that // speaks one language sets Config.Locale. FallbackLocale = "en" )
const ( ViewDashboard = "modules.investor.dashboard" ViewStatement = "modules.investor.statement" ViewProjection = "modules.investor.projection" ViewAdminInvestors = "modules.investor.admin.investors" ViewAdminInvestor = "modules.investor.admin.investor" ViewAdminCosts = "modules.investor.admin.costs" ViewAdminEntries = "modules.investor.admin.entries" ViewAdminWithdrawal = "modules.investor.admin.withdrawals" )
The screens this package renders, by the name their path gives them.
const ActivityLogName = "investor"
ActivityLogName is the log every entry of this package is recorded in.
const AdminRole = "investor.admin"
AdminRole is the role an application grants to the people who run the investors' money: finance, whoever registers investors, closes periods and declares costs.
One role and not several. The rules below need exactly one distinction -- the investor, and somebody acting across the tenant on the investors' behalf. Which people hold it is the application's to decide, through arandu-permission; this package only reads it off the subject.
const DayLayout = "2006-01-02"
DayLayout is the format a Day is written in.
const DefaultLocation = "America/Sao_Paulo"
DefaultLocation is the timezone days are counted in when Config leaves Location nil. The package is Brazilian first; an application elsewhere sets its own.
const MaxContractBytes = 20 << 20
MaxContractBytes is the largest signed file accepted. A scanned contract of a few pages is far below it; a file above it is a mistake, or worse.
const PayoutVia = "investor"
PayoutVia is the name this package asks for its investors' withdrawals under, and the one their wallets are opened with: arandu-wallet refuses a request for those wallets that does not carry it.
const PublishCommand = "aru vendor:publish --apply"
PublishCommand is what an application runs to take ownership of the views this package offers.
It is spelled out as a constant so that whatever says it -- the refusal below, or a message an application writes for its own operators -- says one thing. A person who is told two different commands for one job tries both.
The command reads the modules the application registered and writes what each one declares, which is why it is the application's command and not this package's: nothing outside the application knows which modules it holds.
const WalletSlug = "investor"
WalletSlug is the slug of the investor's wallet in arandu-wallet: one per investor, held by their login user, in reais. Every invoice is deposited there and every withdrawal of one is paid out of it.
Variables ¶
var BankAccountTypes = []string{"checking", "savings"}
BankAccountTypes are the kinds of bank account an investor can be paid into: checking and savings.
var DefaultPaths = Paths{
Me: "/me", Contracts: "/contracts", Invoices: "/invoices", Reports: "/reports", PayoutAccounts: "/payout-accounts",
File: "/file", Statement: "/statement", Projection: "/projection", Costs: "/costs",
Withdrawal: "/withdrawal", Receipt: "/receipt",
Admin: "/admin", Investors: "/investors", Suspension: "/suspension", Amendments: "/amendments",
Closings: "/closings", Due: "/due", Entries: "/entries", Reversal: "/reversal", End: "/end",
Withdrawals: "/withdrawals", Processing: "/processing", Payment: "/payment", Rejection: "/rejection",
}
DefaultPaths are the English segments, the addresses of earlier releases.
var ErrNotFound = fmt.Errorf("investor: record not found: %w", model.ErrModelNotFound)
ErrNotFound is returned when no row matches, including when the row exists in another tenant. The two cases are deliberately indistinguishable.
It wraps model.ErrModelNotFound, so the router answers it with 404 and a caller can still ask for it by name with errors.Is.
var ErrNotWithdrawable = errors.New("investor: this invoice cannot be withdrawn now")
ErrNotWithdrawable is an invoice that cannot be asked for: nothing due, already paid out, or a request for it still waiting.
var PixKeyTypes = []string{"cpf", "cnpj", "email", "phone", "random"}
PixKeyTypes are the kinds of PIX key an investor can be paid into.
var PortuguesePaths = Paths{
Me: "/", Contracts: "/contratos", Invoices: "/faturas", Reports: "/relatorios", PayoutAccounts: "/conta-de-recebimento",
File: "/arquivo", Statement: "/extrato", Projection: "/projecao", Costs: "/custos",
Withdrawal: "/saque", Receipt: "/comprovante",
Admin: "/admin", Investors: "/investidores", Suspension: "/suspensao", Amendments: "/aditivos",
Closings: "/fechamentos", Due: "/vencidos", Entries: "/lancamentos", Reversal: "/estorno", End: "/encerramento",
Withdrawals: "/saques", Processing: "/em-pagamento", Payment: "/pagamento", Rejection: "/recusa",
}
PortuguesePaths are the segments in Brazilian Portuguese, for an application whose addresses are written in it: the investor's panel at Prefix itself, /contratos, /faturas/{id}/saque, /faturas/{id}/comprovante, /conta-de-recebimento, and the admin's /investidores and /saques.
Functions ¶
func AllocateCosts ¶
func AllocateCosts(costs []ScopedCost, revenue map[string]int64, contract Scope) int64
AllocateCosts is the part of the costs a contract bears.
revenue is the gross of the window by product, over the whole application -- not only the contract's products, because a cost of the whole application is shared over all of its revenue. A cost whose products earned nothing in the window is borne whole by a contract that covers all of them, and by nobody else: it has no revenue to be shared over.
func CompleteFilters ¶ added in v0.5.0
func CompleteFilters(rows []components.TableRow, filters ...components.DataTableFilter) []components.DataTableFilter
CompleteFilters are the faceted filters of a list that holds all its rows, which the browser narrows by what each row says in TableRow.Facets. A filter that names no Options offers the values the rows carry, in the order they first appear; one that does name them keeps only those some row carries, so a value nobody has is not offered. The count beside a value is how many rows carry it. A filter that would offer fewer than two values narrows nothing and is left out.
func CostInWindow ¶
CostInWindow is how much of one cost falls in the window [start, end), for a contract that closes on billingDay.
func IsAdmin ¶ added in v0.2.0
IsAdmin says whether the subject is this package's admin: they carry AdminRole, or AdminAction among the actions arandu-permission resolved for them. The policy decides with it; an application asks it to decide what to offer, never to authorize.
func Lines ¶ added in v0.3.0
func Lines(locale string) translation.Lines
Lines are the sentences this package ships for one locale, keyed the way a translator asks for them ("investor.validation.required"), and nil for a locale it does not ship. An application reads them to see what there is to override, or to check a catalogue of its own against them.
func NextOnly ¶ added in v0.5.0
func NextOnly(next string) components.Paginator
NextOnly is the page of a list the package reads by cursor and tells nothing else about: the address of the page after this one, not the number of the page, not the total, not the way back. A data table given it as its Paginator draws the one step.
func PublishedPaths ¶
func PublishedPaths() []string
PublishedPaths are the files in the archive, each relative to the root of the application, sorted.
func ViewNames ¶
func ViewNames() []string
ViewNames are the names the published views are rendered by, sorted.
The name is the path under the view root with its separators turned into dots, which is what the view compiler writes into the registration call. It is derived from the same archive the publication carries, so a view that was renamed cannot keep an old name here.
func ViewPackages ¶
func ViewPackages() []string
ViewPackages are the directories the compiled views land in, each relative to the root of the application, sorted and without repeats.
Importing one is what puts its views in the binary: a compiled view calls the registry from init(), and a package nothing imports is not linked at all. The import is named rather than written into bootstrap/app.go, because one line somebody reads beats a file that changed while they were not looking.
Types ¶
type AccountOption ¶
type AccountOption struct{ ID, Label, Kind string }
AccountOption is one payout account a withdrawal can be paid into: its label, and its kind, PayoutPix or PayoutBank.
type AdminCostsPageData ¶
AdminCostsPageData is the declared costs, for the admin.
type AdminEntriesPageData ¶
type AdminEntriesPageData struct {
Screen
Rows []EntryRow
Query, Kind, Sort, Dir string
CurrentPage, Pages, Total int
URL, StoreURL, CloseDueURL, Today string
// PageSize is how many rows one page holds, the size the server reads
// the books with; the table's footer and its pager count by it.
PageSize int
// Hide are the keys of the columns the reader switched off, as the
// address carried them (hide=source&hide=ref), limited to the columns
// that can be hidden. The table draws its state from them.
Hide []string
}
AdminEntriesPageData is the admin's books, a page at a time.
type AdminInvestorPageData ¶
type AdminInvestorPageData struct {
Screen
Investor InvestorRow
LegalName, LegalRepresentative string
Contracts []ContractRow
Invoices []InvoiceRow
ContractStoreURL string
UpdateURL, SuspensionURL string
ReportsURL string
Year, Month int
Today string
}
AdminInvestorPageData is one investor, for the admin.
type AdminInvestorsPageData ¶
type AdminInvestorsPageData struct {
Screen
Rows []InvestorRow
StoreURL string
Next, NextURL string
}
AdminInvestorsPageData is the admin's registry.
type AdminWithdrawalsPageData ¶
type AdminWithdrawalsPageData struct {
Screen
Rows []WithdrawalRow
Status string
URL string
}
AdminWithdrawalsPageData is the queue of investors' withdrawals.
type BankAccountRequest ¶ added in v0.2.0
type BankAccountRequest struct {
// Bank is the bank's code or name: "341", "Itaú".
Bank string
// Branch is the agency, with its digit when it has one.
Branch string
// Number is the account number, with its digit.
Number string
// Type is one of BankAccountTypes.
Type string
}
BankAccountRequest is a bank account an investor declares to be paid into. The holder is not here: an investor is paid into an account in the name and the document of their registration, whatever a form says.
func (BankAccountRequest) Validate ¶ added in v0.2.0
func (r BankAccountRequest) Validate() validation.Errors
Validate reports the errors per field.
type ChromeRequest ¶ added in v0.2.0
type ChromeRequest struct {
// Title is the screen's title, already in the request's language, without
// the application's name Config.TitleSeparator adds to Page.Title: what a
// heading or a breadcrumb draws.
Title string
// Admin says the screen is one of the admin's, mounted under AdminPrefix.
Admin bool
// Subject is who is asking, as RequireAuth and Config.Middleware left it.
Subject security.Subject
// Page is the page hesape's view.New built for the request.
Page hview.Page
}
ChromeRequest is what Config.Chrome is asked about one screen.
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection is a page of records as one response.
func NewCollection ¶
func NewCollection(records []Investor, cursor string) Collection
NewCollection wraps a page of records for the response. The cursor is what the next request passes back, and is empty when there is no next page.
func (Collection) ToArray ¶
func (c Collection) ToArray() map[string]any
ToArray returns the page under a single key, so that the shape of the response does not change when a second key is added beside it.
func (Collection) With ¶
func (c Collection) With() map[string]any
With returns the cursor of the next page, and nothing when there is none.
type Config ¶
type Config struct {
// Prefix is the path the routes are mounted under. Empty means
// DefaultPrefix.
Prefix string
// PageSize is how many records one page answers with. Zero means
// DefaultPageSize, and anything above MaxPageSize is refused rather than
// clamped: a number somebody wrote and did not get is worse than a number
// somebody wrote and was told about.
PageSize int
// Files is the Disk the signed contracts are kept on: the application's,
// local or S3, reached with the Grant so every key carries the tenant's
// prefix. Required: a contract without its signed copy is the one thing
// this package exists to keep.
Files *filesystem.Disk
// Location is the timezone an instant becomes a calendar day in, which is
// what a period counts by: a sale at 22:00 in Sao Paulo on the 19th is a
// sale of the 19th, though it is already the 20th in UTC. Nil means
// DefaultLocation.
Location *time.Location
// Wallet is arandu-wallet's service, the application's one instance
// (walletModule.Service()). Required: an invoice is deposited in the
// investor's wallet and withdrawn from it, and this package keeps no
// balance of its own.
Wallet *wallet.WalletService
// Payer is the company that pays the investors, printed on the yearly
// income report. Optional: left empty, the report prints a dash.
Payer Payer
// Translator is the application's own catalogue, asked before the one this
// package ships, key by key: "investor.screen.dashboard_title". Optional.
Translator *translation.Translator
// Locale is the language every screen, validation message, report and
// activity description of this package is written in, whatever the
// request negotiated: "pt-BR" for an application that speaks Brazilian
// Portuguese and nothing else. Empty means the locale translation.Middleware
// or translation.InLocale put on the request, and FallbackLocale (English)
// when there is none. The package ships the locales Locales() lists; any
// other reads the application's Translator first and English after it.
Locale string
// TitleSeparator joins a screen's title to the application's name in the
// document title: with " — ", the admin's queue is titled
// "Saques dos investidores — Alpr.sh". The name is the APP_NAME hesape's
// view.New read from the request, the one the layout draws as its brand,
// so nothing here repeats it. Empty, or a request that carries no
// application name, titles a screen with its own title alone, as earlier
// releases did.
TitleSeparator string
// Paths are the segments every route is built from, under Prefix and
// AdminPrefix. A field left empty keeps its DefaultPaths value, so the zero
// value answers at the addresses earlier releases did; PortuguesePaths is
// the whole set in Brazilian Portuguese.
Paths Paths
// AdminPrefix is where the admin's routes are mounted. Empty means Prefix
// followed by Paths.Admin, which is where earlier releases put them. An
// application whose team works on another side of the site -- an operator
// console at /admin -- mounts them there.
AdminPrefix string
// Middleware runs on every route of this package after RequireAuth, in
// order, and AdminMiddleware after it on the admin's routes only. An
// application whose permissions arandu-permission administers mounts its
// Roles() in Middleware: RequireAuth puts the subject as the session
// resolved it, without the actions arandu-permission resolves on each
// request. A guard of the application's own side -- the operator console's
// -- goes in AdminMiddleware. Nil runs nothing more. A guard answers "is
// this request on the right side" and stops; the policy still decides.
Middleware []func(http.Handler) http.Handler
AdminMiddleware []func(http.Handler) http.Handler
// Chrome is what the application's layout draws around a screen of this
// package: its sidebar, its navigation, the account menu. It is called once
// per screen, after RequireAuth and before the page is rendered, and what it
// answers is carried on the page as Screen.Chrome, where a layout asserts
// the interface it draws from. An error is returned as the handler's. Nil
// draws the screens with the page hesape's view.New builds and nothing
// more.
Chrome func(ctx *fhttp.Context, req ChromeRequest) (any, error)
// Activity is arandu-activitylog's logger, the application's one instance
// (activityModule.Logger()). Every act that changes something -- an
// investor, a contract, an entry, a cost, a closing, a payout account, a
// withdrawal asked for, taken, paid or rejected -- is recorded under the
// Grant it was authorized with, in the log named ActivityLogName. Nil
// records nothing.
Activity *activitylog.Logger
}
Config is what the application passes when it wires this package.
A typed struct rather than a map: a misspelled key in a map is a setting that silently keeps its default, and the failure shows up as behaviour nobody asked for rather than as an error. Here a field that does not exist does not compile.
It names no tenant, and that is deliberate. Every route sits behind RequireAuth, so the tenant of every statement is the one the Grant carries, from the session of whoever is asking; a tenant written here would be a second place for one to come from. The zero value is a valid configuration.
type Contract ¶
type Contract struct {
model.Model
ID string `db:"id"`
TenantID string `db:"tenant_id"`
// InvestorID is whose contract this is.
InvestorID string `db:"investor_id"`
// Number is how the contract is called on paper.
Number string `db:"number"`
// Version is 1 for the original and grows by one with each amendment.
Version int `db:"version"`
// RootID is the original contract every version belongs to: the
// original's own id on the original, and the same id on each amendment.
RootID string `db:"root_id"`
// SignedOn, StartsOn and EndsOn are calendar days. EndsOn is empty while
// the contract has no end.
SignedOn Day `db:"signed_on"`
StartsOn Day `db:"starts_on"`
EndsOn Day `db:"ends_on"`
ShareBps int64 `db:"share_bps"`
// BillingDay is the day of the month the contract's period closes, 1 to 28.
BillingDay int `db:"billing_day"`
// AllProducts is a contract over the whole application. When it is false,
// only the products listed for it count.
AllProducts Flag `db:"all_products"`
// Status is whether this version is the one in force.
Status ContractStatus `db:"status"`
// The signed file, kept on the Disk the application passed in. FileKey is
// the key on that Disk; the tenant prefix is the Disk's, from the Grant.
FileKey string `db:"file_key"`
FileName string `db:"file_name"`
FileType string `db:"file_type"`
FileSize int64 `db:"file_size"`
FileSHA256 string `db:"file_sha256"`
// CreatedBy is the subject who registered this version.
CreatedBy string `db:"created_by"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
Contract is what an investor signed: the share of the net they earn, the day the period closes, the products whose revenue counts, and the signed file.
An amendment is a new Contract with the same RootID as the original and the next Version. Nothing is overwritten: the old version stays readable, superseded, and the closings already made against it keep pointing at it.
func (*Contract) Fresh ¶
Fresh reads the row again, as a new Contract; it shadows the untyped one the embedded model promotes.
type ContractCollection ¶
type ContractCollection []*Contract
ContractCollection is rows of Contract, as a query returns them.
func ContractCollectionOf ¶
func ContractCollectionOf(rows model.Rows) ContractCollection
ContractCollectionOf converts rows of the table of Contract. A nil input is a nil collection.
func (ContractCollection) Contains ¶
func (c ContractCollection) Contains(key any) bool
func (ContractCollection) Except ¶
func (c ContractCollection) Except(keys ...any) ContractCollection
func (ContractCollection) Find ¶
func (c ContractCollection) Find(key any) *Contract
func (ContractCollection) FindOrFail ¶
func (c ContractCollection) FindOrFail(key any) (*Contract, error)
func (ContractCollection) Fresh ¶
func (c ContractCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (ContractCollection, error)
func (ContractCollection) LoadMissing ¶
func (ContractCollection) ModelKeys ¶
func (c ContractCollection) ModelKeys() []any
func (ContractCollection) Only ¶
func (c ContractCollection) Only(keys ...any) ContractCollection
func (ContractCollection) Pluck ¶
func (c ContractCollection) Pluck(column string) []any
func (ContractCollection) Rows ¶
func (c ContractCollection) Rows() model.Rows
Rows converts the collection back to the core's rows.
func (ContractCollection) ToArray ¶
func (c ContractCollection) ToArray() []map[string]any
func (ContractCollection) Unique ¶
func (c ContractCollection) Unique() ContractCollection
type ContractList ¶
type ContractList struct {
// contains filtered or unexported fields
}
ContractList is a list of contracts as one response.
func (ContractList) ToArray ¶
func (c ContractList) ToArray() map[string]any
ToArray returns the list under a single key.
func (ContractList) With ¶
func (c ContractList) With() map[string]any
With returns nothing beside the list.
type ContractProduct ¶
type ContractProduct struct {
model.Model
ID string `db:"id"`
TenantID string `db:"tenant_id"`
ContractID string `db:"contract_id"`
// ProductID is the application's identifier of the product. This package
// never resolves it: what a product is belongs to the application.
ProductID string `db:"product_id"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
ContractProduct is one product whose revenue counts for a contract that does not cover the whole application.
func (*ContractProduct) Fresh ¶
func (row *ContractProduct) Fresh(ctx context.Context, g auth.Grant, with ...string) (*ContractProduct, error)
Fresh reads the row again, as a new ContractProduct; it shadows the untyped one the embedded model promotes.
func (*ContractProduct) Replicate ¶
func (row *ContractProduct) Replicate(except ...string) (*ContractProduct, error)
Replicate returns an unsaved copy of the row without its key; it shadows the untyped one the embedded model promotes.
type ContractProductCollection ¶
type ContractProductCollection []*ContractProduct
ContractProductCollection is rows of ContractProduct, as a query returns them.
func ContractProductCollectionOf ¶
func ContractProductCollectionOf(rows model.Rows) ContractProductCollection
ContractProductCollectionOf converts rows of the table of ContractProduct. A nil input is a nil collection.
func (ContractProductCollection) Contains ¶
func (c ContractProductCollection) Contains(key any) bool
func (ContractProductCollection) Except ¶
func (c ContractProductCollection) Except(keys ...any) ContractProductCollection
func (ContractProductCollection) Find ¶
func (c ContractProductCollection) Find(key any) *ContractProduct
func (ContractProductCollection) FindOrFail ¶
func (c ContractProductCollection) FindOrFail(key any) (*ContractProduct, error)
func (ContractProductCollection) Fresh ¶
func (c ContractProductCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (ContractProductCollection, error)
func (ContractProductCollection) LoadMissing ¶
func (ContractProductCollection) ModelKeys ¶
func (c ContractProductCollection) ModelKeys() []any
func (ContractProductCollection) Only ¶
func (c ContractProductCollection) Only(keys ...any) ContractProductCollection
func (ContractProductCollection) Pluck ¶
func (c ContractProductCollection) Pluck(column string) []any
func (ContractProductCollection) Rows ¶
func (c ContractProductCollection) Rows() model.Rows
Rows converts the collection back to the core's rows.
func (ContractProductCollection) ToArray ¶
func (c ContractProductCollection) ToArray() []map[string]any
func (ContractProductCollection) Unique ¶
func (c ContractProductCollection) Unique() ContractProductCollection
type ContractProductQuery ¶
type ContractProductQuery struct {
// contains filtered or unexported fields
}
ContractProductQuery is a query on the table of ContractProduct.
The methods that build return the query, so they chain. The methods that run take a context and an auth.Grant, and return ContractProduct rows or a value; there is no way to run one without a Grant.
func ContractProducts ¶
func ContractProducts(db model.DB) *ContractProductQuery
ContractProducts starts a query on the table of ContractProduct, through db.
Global scopes are on and, unless the table is Global, every statement is filtered by the tenant of the Grant its terminal takes.
func (*ContractProductQuery) AddSelect ¶
func (q *ContractProductQuery) AddSelect(columns ...any) *ContractProductQuery
func (*ContractProductQuery) Base ¶
func (q *ContractProductQuery) Base() *model.Builder
Base returns the core builder the query forwards to. It is for code in this package -- a local scope in the custom block of contract.go -- and for the factory, which builds rows through it.
func (*ContractProductQuery) Clone ¶
func (q *ContractProductQuery) Clone() *ContractProductQuery
Clone returns an independent copy of the query.
func (*ContractProductQuery) Create ¶
func (q *ContractProductQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*ContractProduct, error)
func (*ContractProductQuery) Cursor ¶
func (q *ContractProductQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*ContractProduct, error]
func (*ContractProductQuery) CursorPaginate ¶
func (q *ContractProductQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, opts pagination.Options, columns ...any) (ContractProductCollection, *pagination.CursorPage, error)
func (*ContractProductQuery) DoesntExist ¶
func (*ContractProductQuery) DoesntHave ¶
func (q *ContractProductQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *ContractProductQuery
func (*ContractProductQuery) Find ¶
func (q *ContractProductQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*ContractProduct, error)
func (*ContractProductQuery) FindMany ¶
func (q *ContractProductQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (ContractProductCollection, error)
func (*ContractProductQuery) FindOrFail ¶
func (q *ContractProductQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*ContractProduct, error)
func (*ContractProductQuery) FindOrNew ¶
func (q *ContractProductQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*ContractProduct, error)
func (*ContractProductQuery) First ¶
func (q *ContractProductQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*ContractProduct, error)
First returns the first row, or nil and no error when there is none.
func (*ContractProductQuery) FirstOrCreate ¶
func (q *ContractProductQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*ContractProduct, error)
func (*ContractProductQuery) FirstOrFail ¶
func (q *ContractProductQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*ContractProduct, error)
func (*ContractProductQuery) FirstOrNew ¶
func (q *ContractProductQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*ContractProduct, error)
func (*ContractProductQuery) FirstWhere ¶
func (q *ContractProductQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*ContractProduct, error)
func (*ContractProductQuery) ForPage ¶
func (q *ContractProductQuery) ForPage(page, perPage int) *ContractProductQuery
func (*ContractProductQuery) ForceCreate ¶
func (q *ContractProductQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*ContractProduct, error)
func (*ContractProductQuery) Get ¶
func (q *ContractProductQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (ContractProductCollection, error)
Get runs the query and returns the rows.
func (*ContractProductQuery) GroupBy ¶
func (q *ContractProductQuery) GroupBy(groups ...any) *ContractProductQuery
func (*ContractProductQuery) Has ¶
func (q *ContractProductQuery) Has(relation, operator string, count int, boolean string, callback func(*query.Builder)) *ContractProductQuery
func (*ContractProductQuery) InsertOrIgnore ¶
func (*ContractProductQuery) Join ¶
func (q *ContractProductQuery) Join(table any, first any, args ...any) *ContractProductQuery
func (*ContractProductQuery) Latest ¶
func (q *ContractProductQuery) Latest(column ...string) *ContractProductQuery
func (*ContractProductQuery) Limit ¶
func (q *ContractProductQuery) Limit(value int) *ContractProductQuery
func (*ContractProductQuery) New ¶
func (q *ContractProductQuery) New() (*ContractProduct, error)
New returns an empty ContractProduct on the query's connection, not yet saved, filled with what WithAttributes recorded on the query.
func (*ContractProductQuery) Offset ¶
func (q *ContractProductQuery) Offset(value int) *ContractProductQuery
func (*ContractProductQuery) Oldest ¶
func (q *ContractProductQuery) Oldest(column ...string) *ContractProductQuery
func (*ContractProductQuery) OrDoesntHave ¶
func (q *ContractProductQuery) OrDoesntHave(relation string) *ContractProductQuery
func (*ContractProductQuery) OrHas ¶
func (q *ContractProductQuery) OrHas(relation, operator string, count int) *ContractProductQuery
func (*ContractProductQuery) OrWhere ¶
func (q *ContractProductQuery) OrWhere(column any, args ...any) *ContractProductQuery
OrWhere adds an or-where clause; a func(*ContractProductQuery) in place of the column adds a group.
func (*ContractProductQuery) OrWhereDoesntHave ¶
func (q *ContractProductQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *ContractProductQuery
func (*ContractProductQuery) OrWhereHas ¶
func (q *ContractProductQuery) OrWhereHas(relation string, callback func(*query.Builder)) *ContractProductQuery
func (*ContractProductQuery) OrWhereNot ¶
func (q *ContractProductQuery) OrWhereNot(column any, args ...any) *ContractProductQuery
OrWhereNot adds an or-joined negated where clause, or a negated group.
func (*ContractProductQuery) OrWhereRelation ¶
func (q *ContractProductQuery) OrWhereRelation(relation string, column any, args ...any) *ContractProductQuery
func (*ContractProductQuery) OrderBy ¶
func (q *ContractProductQuery) OrderBy(column any, direction ...string) *ContractProductQuery
func (*ContractProductQuery) OrderByDesc ¶
func (q *ContractProductQuery) OrderByDesc(column any) *ContractProductQuery
func (*ContractProductQuery) Paginate ¶
func (q *ContractProductQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (ContractProductCollection, *pagination.LengthAwarePage, error)
func (*ContractProductQuery) Select ¶
func (q *ContractProductQuery) Select(columns ...any) *ContractProductQuery
func (*ContractProductQuery) SelectRaw ¶
func (q *ContractProductQuery) SelectRaw(expression string, bindings ...any) *ContractProductQuery
func (*ContractProductQuery) SimplePaginate ¶
func (q *ContractProductQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (ContractProductCollection, *pagination.Page, error)
func (*ContractProductQuery) Sole ¶
func (q *ContractProductQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*ContractProduct, error)
func (*ContractProductQuery) UpdateOrCreate ¶
func (q *ContractProductQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*ContractProduct, error)
func (*ContractProductQuery) ValueOrFail ¶
func (*ContractProductQuery) Where ¶
func (q *ContractProductQuery) Where(column any, args ...any) *ContractProductQuery
Where adds a where clause; a func(*ContractProductQuery) in place of the column adds a group.
func (*ContractProductQuery) WhereBelongsTo ¶
func (q *ContractProductQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *ContractProductQuery
func (*ContractProductQuery) WhereBetween ¶
func (q *ContractProductQuery) WhereBetween(column any, from, to any) *ContractProductQuery
func (*ContractProductQuery) WhereColumn ¶
func (q *ContractProductQuery) WhereColumn(first any, args ...any) *ContractProductQuery
func (*ContractProductQuery) WhereDoesntHave ¶
func (q *ContractProductQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *ContractProductQuery
func (*ContractProductQuery) WhereExists ¶
func (q *ContractProductQuery) WhereExists(callback func(*query.Builder)) *ContractProductQuery
func (*ContractProductQuery) WhereHas ¶
func (q *ContractProductQuery) WhereHas(relation string, callback func(*query.Builder)) *ContractProductQuery
func (*ContractProductQuery) WhereHasCount ¶
func (q *ContractProductQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *ContractProductQuery
func (*ContractProductQuery) WhereIn ¶
func (q *ContractProductQuery) WhereIn(column any, values []any) *ContractProductQuery
func (*ContractProductQuery) WhereKey ¶
func (q *ContractProductQuery) WhereKey(id any) *ContractProductQuery
func (*ContractProductQuery) WhereNot ¶
func (q *ContractProductQuery) WhereNot(column any, args ...any) *ContractProductQuery
WhereNot adds a negated where clause, or a negated group.
func (*ContractProductQuery) WhereNotExists ¶
func (q *ContractProductQuery) WhereNotExists(callback func(*query.Builder)) *ContractProductQuery
func (*ContractProductQuery) WhereNotIn ¶
func (q *ContractProductQuery) WhereNotIn(column any, values []any) *ContractProductQuery
func (*ContractProductQuery) WhereNotNull ¶
func (q *ContractProductQuery) WhereNotNull(columns ...any) *ContractProductQuery
func (*ContractProductQuery) WhereNull ¶
func (q *ContractProductQuery) WhereNull(columns ...any) *ContractProductQuery
func (*ContractProductQuery) WhereRelation ¶
func (q *ContractProductQuery) WhereRelation(relation string, column any, args ...any) *ContractProductQuery
func (*ContractProductQuery) With ¶
func (q *ContractProductQuery) With(relations ...string) *ContractProductQuery
func (*ContractProductQuery) WithAvg ¶
func (q *ContractProductQuery) WithAvg(relation, column string) *ContractProductQuery
func (*ContractProductQuery) WithCount ¶
func (q *ContractProductQuery) WithCount(relations ...string) *ContractProductQuery
func (*ContractProductQuery) WithExists ¶
func (q *ContractProductQuery) WithExists(relation string) *ContractProductQuery
func (*ContractProductQuery) WithMax ¶
func (q *ContractProductQuery) WithMax(relation, column string) *ContractProductQuery
func (*ContractProductQuery) WithMin ¶
func (q *ContractProductQuery) WithMin(relation, column string) *ContractProductQuery
func (*ContractProductQuery) WithSum ¶
func (q *ContractProductQuery) WithSum(relation, column string) *ContractProductQuery
func (*ContractProductQuery) Without ¶
func (q *ContractProductQuery) Without(relations ...string) *ContractProductQuery
func (*ContractProductQuery) WithoutGlobalScope ¶
func (q *ContractProductQuery) WithoutGlobalScope(identifier string) *ContractProductQuery
func (*ContractProductQuery) WithoutGlobalScopes ¶
func (q *ContractProductQuery) WithoutGlobalScopes(identifiers ...string) *ContractProductQuery
type ContractQuery ¶
type ContractQuery struct {
// contains filtered or unexported fields
}
ContractQuery is a query on the table of Contract.
The methods that build return the query, so they chain. The methods that run take a context and an auth.Grant, and return Contract rows or a value; there is no way to run one without a Grant.
func Contracts ¶
func Contracts(db model.DB) *ContractQuery
Contracts starts a query on the table of Contract, through db.
Global scopes are on and, unless the table is Global, every statement is filtered by the tenant of the Grant its terminal takes.
func (*ContractQuery) AddSelect ¶
func (q *ContractQuery) AddSelect(columns ...any) *ContractQuery
func (*ContractQuery) Base ¶
func (q *ContractQuery) Base() *model.Builder
Base returns the core builder the query forwards to. It is for code in this package -- a local scope in the custom block of contract.go -- and for the factory, which builds rows through it.
func (*ContractQuery) Clone ¶
func (q *ContractQuery) Clone() *ContractQuery
Clone returns an independent copy of the query.
func (*ContractQuery) CursorPaginate ¶
func (q *ContractQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, opts pagination.Options, columns ...any) (ContractCollection, *pagination.CursorPage, error)
func (*ContractQuery) DoesntExist ¶
func (*ContractQuery) DoesntHave ¶
func (q *ContractQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *ContractQuery
func (*ContractQuery) FindMany ¶
func (q *ContractQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (ContractCollection, error)
func (*ContractQuery) FindOrFail ¶
func (*ContractQuery) FirstOrCreate ¶
func (*ContractQuery) FirstOrFail ¶
func (*ContractQuery) FirstOrNew ¶
func (*ContractQuery) FirstWhere ¶
func (*ContractQuery) ForPage ¶
func (q *ContractQuery) ForPage(page, perPage int) *ContractQuery
func (*ContractQuery) ForceCreate ¶
func (*ContractQuery) Get ¶
func (q *ContractQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (ContractCollection, error)
Get runs the query and returns the rows.
func (*ContractQuery) GroupBy ¶
func (q *ContractQuery) GroupBy(groups ...any) *ContractQuery
func (*ContractQuery) Has ¶
func (q *ContractQuery) Has(relation, operator string, count int, boolean string, callback func(*query.Builder)) *ContractQuery
func (*ContractQuery) InsertOrIgnore ¶
func (*ContractQuery) Join ¶
func (q *ContractQuery) Join(table any, first any, args ...any) *ContractQuery
func (*ContractQuery) Latest ¶
func (q *ContractQuery) Latest(column ...string) *ContractQuery
func (*ContractQuery) Limit ¶
func (q *ContractQuery) Limit(value int) *ContractQuery
func (*ContractQuery) New ¶
func (q *ContractQuery) New() (*Contract, error)
New returns an empty Contract on the query's connection, not yet saved, filled with what WithAttributes recorded on the query.
func (*ContractQuery) Offset ¶
func (q *ContractQuery) Offset(value int) *ContractQuery
func (*ContractQuery) Oldest ¶
func (q *ContractQuery) Oldest(column ...string) *ContractQuery
func (*ContractQuery) OrDoesntHave ¶
func (q *ContractQuery) OrDoesntHave(relation string) *ContractQuery
func (*ContractQuery) OrHas ¶
func (q *ContractQuery) OrHas(relation, operator string, count int) *ContractQuery
func (*ContractQuery) OrWhere ¶
func (q *ContractQuery) OrWhere(column any, args ...any) *ContractQuery
OrWhere adds an or-where clause; a func(*ContractQuery) in place of the column adds a group.
func (*ContractQuery) OrWhereDoesntHave ¶
func (q *ContractQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *ContractQuery
func (*ContractQuery) OrWhereHas ¶
func (q *ContractQuery) OrWhereHas(relation string, callback func(*query.Builder)) *ContractQuery
func (*ContractQuery) OrWhereNot ¶
func (q *ContractQuery) OrWhereNot(column any, args ...any) *ContractQuery
OrWhereNot adds an or-joined negated where clause, or a negated group.
func (*ContractQuery) OrWhereRelation ¶
func (q *ContractQuery) OrWhereRelation(relation string, column any, args ...any) *ContractQuery
func (*ContractQuery) OrderBy ¶
func (q *ContractQuery) OrderBy(column any, direction ...string) *ContractQuery
func (*ContractQuery) OrderByDesc ¶
func (q *ContractQuery) OrderByDesc(column any) *ContractQuery
func (*ContractQuery) Paginate ¶
func (q *ContractQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (ContractCollection, *pagination.LengthAwarePage, error)
func (*ContractQuery) Select ¶
func (q *ContractQuery) Select(columns ...any) *ContractQuery
func (*ContractQuery) SelectRaw ¶
func (q *ContractQuery) SelectRaw(expression string, bindings ...any) *ContractQuery
func (*ContractQuery) SimplePaginate ¶
func (q *ContractQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (ContractCollection, *pagination.Page, error)
func (*ContractQuery) UpdateOrCreate ¶
func (*ContractQuery) ValueOrFail ¶
func (*ContractQuery) Where ¶
func (q *ContractQuery) Where(column any, args ...any) *ContractQuery
Where adds a where clause; a func(*ContractQuery) in place of the column adds a group.
func (*ContractQuery) WhereBelongsTo ¶
func (q *ContractQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *ContractQuery
func (*ContractQuery) WhereBetween ¶
func (q *ContractQuery) WhereBetween(column any, from, to any) *ContractQuery
func (*ContractQuery) WhereColumn ¶
func (q *ContractQuery) WhereColumn(first any, args ...any) *ContractQuery
func (*ContractQuery) WhereDoesntHave ¶
func (q *ContractQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *ContractQuery
func (*ContractQuery) WhereExists ¶
func (q *ContractQuery) WhereExists(callback func(*query.Builder)) *ContractQuery
func (*ContractQuery) WhereHas ¶
func (q *ContractQuery) WhereHas(relation string, callback func(*query.Builder)) *ContractQuery
func (*ContractQuery) WhereHasCount ¶
func (q *ContractQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *ContractQuery
func (*ContractQuery) WhereIn ¶
func (q *ContractQuery) WhereIn(column any, values []any) *ContractQuery
func (*ContractQuery) WhereKey ¶
func (q *ContractQuery) WhereKey(id any) *ContractQuery
func (*ContractQuery) WhereNot ¶
func (q *ContractQuery) WhereNot(column any, args ...any) *ContractQuery
WhereNot adds a negated where clause, or a negated group.
func (*ContractQuery) WhereNotExists ¶
func (q *ContractQuery) WhereNotExists(callback func(*query.Builder)) *ContractQuery
func (*ContractQuery) WhereNotIn ¶
func (q *ContractQuery) WhereNotIn(column any, values []any) *ContractQuery
func (*ContractQuery) WhereNotNull ¶
func (q *ContractQuery) WhereNotNull(columns ...any) *ContractQuery
func (*ContractQuery) WhereNull ¶
func (q *ContractQuery) WhereNull(columns ...any) *ContractQuery
func (*ContractQuery) WhereRelation ¶
func (q *ContractQuery) WhereRelation(relation string, column any, args ...any) *ContractQuery
func (*ContractQuery) With ¶
func (q *ContractQuery) With(relations ...string) *ContractQuery
func (*ContractQuery) WithAvg ¶
func (q *ContractQuery) WithAvg(relation, column string) *ContractQuery
func (*ContractQuery) WithCount ¶
func (q *ContractQuery) WithCount(relations ...string) *ContractQuery
func (*ContractQuery) WithExists ¶
func (q *ContractQuery) WithExists(relation string) *ContractQuery
func (*ContractQuery) WithMax ¶
func (q *ContractQuery) WithMax(relation, column string) *ContractQuery
func (*ContractQuery) WithMin ¶
func (q *ContractQuery) WithMin(relation, column string) *ContractQuery
func (*ContractQuery) WithSum ¶
func (q *ContractQuery) WithSum(relation, column string) *ContractQuery
func (*ContractQuery) Without ¶
func (q *ContractQuery) Without(relations ...string) *ContractQuery
func (*ContractQuery) WithoutGlobalScope ¶
func (q *ContractQuery) WithoutGlobalScope(identifier string) *ContractQuery
func (*ContractQuery) WithoutGlobalScopes ¶
func (q *ContractQuery) WithoutGlobalScopes(identifiers ...string) *ContractQuery
type ContractRequest ¶
type ContractRequest struct {
Number string
SignedOn string
StartsOn string
EndsOn string
BillingDay int
AllProducts bool
Products []string
FileName string
FileType string
}
ContractRequest is the input contract for registering a contract or an amendment. The file comes beside it, as a reader, so the bytes never pass through a struct a log might print.
func (ContractRequest) Validate ¶
func (r ContractRequest) Validate() validation.Errors
Validate reports the errors per field.
type ContractResource ¶
type ContractResource struct {
// contains filtered or unexported fields
}
ContractResource is the list of fields one Contract answers with.
func NewContractResource ¶
func NewContractResource(c Contract, products []string) ContractResource
NewContractResource snapshots one contract and its products for a response.
func (ContractResource) Contract ¶
func (r ContractResource) Contract() Contract
Contract is the version the resource describes.
func (ContractResource) Products ¶
func (r ContractResource) Products() []string
Products are the products the version's revenue counts, empty when it counts the whole application's.
func (ContractResource) ToArray ¶
func (r ContractResource) ToArray() map[string]any
ToArray returns the fields that may leave, by name. The file is described, never linked: it is read through the package's own download route, which asks the policy first.
func (ContractResource) With ¶
func (r ContractResource) With() map[string]any
With returns nothing beside the fields.
type ContractRow ¶
type ContractRow struct {
// Ends is the last day, or "em aberto" for a contract with none; Period
// is the two together, as a column draws them.
ContractRow is one contract as a screen shows it.
type ContractStatus ¶
type ContractStatus string
ContractStatus is whether a contract version is the one in force.
const ( // ContractActive is the version in force. ContractActive ContractStatus = "active" // ContractSuperseded was replaced by an amendment. ContractSuperseded ContractStatus = "superseded" )
type CostItem ¶
type CostItem struct {
model.Model
ID string `db:"id"`
TenantID string `db:"tenant_id"`
Name string `db:"name"`
Category string `db:"category"`
// Amount is centavos per Recurrence: per month, per year, or once.
Amount int64 `db:"amount"`
Recurrence Recurrence `db:"recurrence"`
// StartsOn is the first day the cost runs, and the day a one-off cost
// happens. EndsOn is the last day it runs, empty while it has no end.
StartsOn Day `db:"starts_on"`
EndsOn Day `db:"ends_on"`
// AllProducts is a cost of the whole application. When it is false, only
// the products listed for it bear it.
AllProducts Flag `db:"all_products"`
CreatedBy string `db:"created_by"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
CostItem is one cost of running the application that is shared out over the revenue: a server, a cluster, a tool, the invoice issuer.
type CostItemCollection ¶
type CostItemCollection []*CostItem
CostItemCollection is rows of CostItem, as a query returns them.
func CostItemCollectionOf ¶
func CostItemCollectionOf(rows model.Rows) CostItemCollection
CostItemCollectionOf converts rows of the table of CostItem. A nil input is a nil collection.
func (CostItemCollection) Contains ¶
func (c CostItemCollection) Contains(key any) bool
func (CostItemCollection) Except ¶
func (c CostItemCollection) Except(keys ...any) CostItemCollection
func (CostItemCollection) Find ¶
func (c CostItemCollection) Find(key any) *CostItem
func (CostItemCollection) FindOrFail ¶
func (c CostItemCollection) FindOrFail(key any) (*CostItem, error)
func (CostItemCollection) Fresh ¶
func (c CostItemCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (CostItemCollection, error)
func (CostItemCollection) LoadMissing ¶
func (CostItemCollection) ModelKeys ¶
func (c CostItemCollection) ModelKeys() []any
func (CostItemCollection) Only ¶
func (c CostItemCollection) Only(keys ...any) CostItemCollection
func (CostItemCollection) Pluck ¶
func (c CostItemCollection) Pluck(column string) []any
func (CostItemCollection) Rows ¶
func (c CostItemCollection) Rows() model.Rows
Rows converts the collection back to the core's rows.
func (CostItemCollection) ToArray ¶
func (c CostItemCollection) ToArray() []map[string]any
func (CostItemCollection) Unique ¶
func (c CostItemCollection) Unique() CostItemCollection
type CostItemProduct ¶
type CostItemProduct struct {
model.Model
ID string `db:"id"`
TenantID string `db:"tenant_id"`
CostItemID string `db:"cost_item_id"`
ProductID string `db:"product_id"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
CostItemProduct is one product that bears a cost that is not the whole application's.
func (*CostItemProduct) Fresh ¶
func (row *CostItemProduct) Fresh(ctx context.Context, g auth.Grant, with ...string) (*CostItemProduct, error)
Fresh reads the row again, as a new CostItemProduct; it shadows the untyped one the embedded model promotes.
func (*CostItemProduct) Replicate ¶
func (row *CostItemProduct) Replicate(except ...string) (*CostItemProduct, error)
Replicate returns an unsaved copy of the row without its key; it shadows the untyped one the embedded model promotes.
type CostItemProductCollection ¶
type CostItemProductCollection []*CostItemProduct
CostItemProductCollection is rows of CostItemProduct, as a query returns them.
func CostItemProductCollectionOf ¶
func CostItemProductCollectionOf(rows model.Rows) CostItemProductCollection
CostItemProductCollectionOf converts rows of the table of CostItemProduct. A nil input is a nil collection.
func (CostItemProductCollection) Contains ¶
func (c CostItemProductCollection) Contains(key any) bool
func (CostItemProductCollection) Except ¶
func (c CostItemProductCollection) Except(keys ...any) CostItemProductCollection
func (CostItemProductCollection) Find ¶
func (c CostItemProductCollection) Find(key any) *CostItemProduct
func (CostItemProductCollection) FindOrFail ¶
func (c CostItemProductCollection) FindOrFail(key any) (*CostItemProduct, error)
func (CostItemProductCollection) Fresh ¶
func (c CostItemProductCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (CostItemProductCollection, error)
func (CostItemProductCollection) LoadMissing ¶
func (CostItemProductCollection) ModelKeys ¶
func (c CostItemProductCollection) ModelKeys() []any
func (CostItemProductCollection) Only ¶
func (c CostItemProductCollection) Only(keys ...any) CostItemProductCollection
func (CostItemProductCollection) Pluck ¶
func (c CostItemProductCollection) Pluck(column string) []any
func (CostItemProductCollection) Rows ¶
func (c CostItemProductCollection) Rows() model.Rows
Rows converts the collection back to the core's rows.
func (CostItemProductCollection) ToArray ¶
func (c CostItemProductCollection) ToArray() []map[string]any
func (CostItemProductCollection) Unique ¶
func (c CostItemProductCollection) Unique() CostItemProductCollection
type CostItemProductQuery ¶
type CostItemProductQuery struct {
// contains filtered or unexported fields
}
CostItemProductQuery is a query on the table of CostItemProduct.
The methods that build return the query, so they chain. The methods that run take a context and an auth.Grant, and return CostItemProduct rows or a value; there is no way to run one without a Grant.
func CostItemProducts ¶
func CostItemProducts(db model.DB) *CostItemProductQuery
CostItemProducts starts a query on the table of CostItemProduct, through db.
Global scopes are on and, unless the table is Global, every statement is filtered by the tenant of the Grant its terminal takes.
func (*CostItemProductQuery) AddSelect ¶
func (q *CostItemProductQuery) AddSelect(columns ...any) *CostItemProductQuery
func (*CostItemProductQuery) Base ¶
func (q *CostItemProductQuery) Base() *model.Builder
Base returns the core builder the query forwards to. It is for code in this package -- a local scope in the custom block of ledger.go -- and for the factory, which builds rows through it.
func (*CostItemProductQuery) Clone ¶
func (q *CostItemProductQuery) Clone() *CostItemProductQuery
Clone returns an independent copy of the query.
func (*CostItemProductQuery) Create ¶
func (q *CostItemProductQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*CostItemProduct, error)
func (*CostItemProductQuery) Cursor ¶
func (q *CostItemProductQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*CostItemProduct, error]
func (*CostItemProductQuery) CursorPaginate ¶
func (q *CostItemProductQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, opts pagination.Options, columns ...any) (CostItemProductCollection, *pagination.CursorPage, error)
func (*CostItemProductQuery) DoesntExist ¶
func (*CostItemProductQuery) DoesntHave ¶
func (q *CostItemProductQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *CostItemProductQuery
func (*CostItemProductQuery) Find ¶
func (q *CostItemProductQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*CostItemProduct, error)
func (*CostItemProductQuery) FindMany ¶
func (q *CostItemProductQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (CostItemProductCollection, error)
func (*CostItemProductQuery) FindOrFail ¶
func (q *CostItemProductQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*CostItemProduct, error)
func (*CostItemProductQuery) FindOrNew ¶
func (q *CostItemProductQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*CostItemProduct, error)
func (*CostItemProductQuery) First ¶
func (q *CostItemProductQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*CostItemProduct, error)
First returns the first row, or nil and no error when there is none.
func (*CostItemProductQuery) FirstOrCreate ¶
func (q *CostItemProductQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*CostItemProduct, error)
func (*CostItemProductQuery) FirstOrFail ¶
func (q *CostItemProductQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*CostItemProduct, error)
func (*CostItemProductQuery) FirstOrNew ¶
func (q *CostItemProductQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*CostItemProduct, error)
func (*CostItemProductQuery) FirstWhere ¶
func (q *CostItemProductQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*CostItemProduct, error)
func (*CostItemProductQuery) ForPage ¶
func (q *CostItemProductQuery) ForPage(page, perPage int) *CostItemProductQuery
func (*CostItemProductQuery) ForceCreate ¶
func (q *CostItemProductQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*CostItemProduct, error)
func (*CostItemProductQuery) Get ¶
func (q *CostItemProductQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (CostItemProductCollection, error)
Get runs the query and returns the rows.
func (*CostItemProductQuery) GroupBy ¶
func (q *CostItemProductQuery) GroupBy(groups ...any) *CostItemProductQuery
func (*CostItemProductQuery) Has ¶
func (q *CostItemProductQuery) Has(relation, operator string, count int, boolean string, callback func(*query.Builder)) *CostItemProductQuery
func (*CostItemProductQuery) InsertOrIgnore ¶
func (*CostItemProductQuery) Join ¶
func (q *CostItemProductQuery) Join(table any, first any, args ...any) *CostItemProductQuery
func (*CostItemProductQuery) Latest ¶
func (q *CostItemProductQuery) Latest(column ...string) *CostItemProductQuery
func (*CostItemProductQuery) Limit ¶
func (q *CostItemProductQuery) Limit(value int) *CostItemProductQuery
func (*CostItemProductQuery) New ¶
func (q *CostItemProductQuery) New() (*CostItemProduct, error)
New returns an empty CostItemProduct on the query's connection, not yet saved, filled with what WithAttributes recorded on the query.
func (*CostItemProductQuery) Offset ¶
func (q *CostItemProductQuery) Offset(value int) *CostItemProductQuery
func (*CostItemProductQuery) Oldest ¶
func (q *CostItemProductQuery) Oldest(column ...string) *CostItemProductQuery
func (*CostItemProductQuery) OrDoesntHave ¶
func (q *CostItemProductQuery) OrDoesntHave(relation string) *CostItemProductQuery
func (*CostItemProductQuery) OrHas ¶
func (q *CostItemProductQuery) OrHas(relation, operator string, count int) *CostItemProductQuery
func (*CostItemProductQuery) OrWhere ¶
func (q *CostItemProductQuery) OrWhere(column any, args ...any) *CostItemProductQuery
OrWhere adds an or-where clause; a func(*CostItemProductQuery) in place of the column adds a group.
func (*CostItemProductQuery) OrWhereDoesntHave ¶
func (q *CostItemProductQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *CostItemProductQuery
func (*CostItemProductQuery) OrWhereHas ¶
func (q *CostItemProductQuery) OrWhereHas(relation string, callback func(*query.Builder)) *CostItemProductQuery
func (*CostItemProductQuery) OrWhereNot ¶
func (q *CostItemProductQuery) OrWhereNot(column any, args ...any) *CostItemProductQuery
OrWhereNot adds an or-joined negated where clause, or a negated group.
func (*CostItemProductQuery) OrWhereRelation ¶
func (q *CostItemProductQuery) OrWhereRelation(relation string, column any, args ...any) *CostItemProductQuery
func (*CostItemProductQuery) OrderBy ¶
func (q *CostItemProductQuery) OrderBy(column any, direction ...string) *CostItemProductQuery
func (*CostItemProductQuery) OrderByDesc ¶
func (q *CostItemProductQuery) OrderByDesc(column any) *CostItemProductQuery
func (*CostItemProductQuery) Paginate ¶
func (q *CostItemProductQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (CostItemProductCollection, *pagination.LengthAwarePage, error)
func (*CostItemProductQuery) Select ¶
func (q *CostItemProductQuery) Select(columns ...any) *CostItemProductQuery
func (*CostItemProductQuery) SelectRaw ¶
func (q *CostItemProductQuery) SelectRaw(expression string, bindings ...any) *CostItemProductQuery
func (*CostItemProductQuery) SimplePaginate ¶
func (q *CostItemProductQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (CostItemProductCollection, *pagination.Page, error)
func (*CostItemProductQuery) Sole ¶
func (q *CostItemProductQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*CostItemProduct, error)
func (*CostItemProductQuery) UpdateOrCreate ¶
func (q *CostItemProductQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*CostItemProduct, error)
func (*CostItemProductQuery) ValueOrFail ¶
func (*CostItemProductQuery) Where ¶
func (q *CostItemProductQuery) Where(column any, args ...any) *CostItemProductQuery
Where adds a where clause; a func(*CostItemProductQuery) in place of the column adds a group.
func (*CostItemProductQuery) WhereBelongsTo ¶
func (q *CostItemProductQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *CostItemProductQuery
func (*CostItemProductQuery) WhereBetween ¶
func (q *CostItemProductQuery) WhereBetween(column any, from, to any) *CostItemProductQuery
func (*CostItemProductQuery) WhereColumn ¶
func (q *CostItemProductQuery) WhereColumn(first any, args ...any) *CostItemProductQuery
func (*CostItemProductQuery) WhereDoesntHave ¶
func (q *CostItemProductQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *CostItemProductQuery
func (*CostItemProductQuery) WhereExists ¶
func (q *CostItemProductQuery) WhereExists(callback func(*query.Builder)) *CostItemProductQuery
func (*CostItemProductQuery) WhereHas ¶
func (q *CostItemProductQuery) WhereHas(relation string, callback func(*query.Builder)) *CostItemProductQuery
func (*CostItemProductQuery) WhereHasCount ¶
func (q *CostItemProductQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *CostItemProductQuery
func (*CostItemProductQuery) WhereIn ¶
func (q *CostItemProductQuery) WhereIn(column any, values []any) *CostItemProductQuery
func (*CostItemProductQuery) WhereKey ¶
func (q *CostItemProductQuery) WhereKey(id any) *CostItemProductQuery
func (*CostItemProductQuery) WhereNot ¶
func (q *CostItemProductQuery) WhereNot(column any, args ...any) *CostItemProductQuery
WhereNot adds a negated where clause, or a negated group.
func (*CostItemProductQuery) WhereNotExists ¶
func (q *CostItemProductQuery) WhereNotExists(callback func(*query.Builder)) *CostItemProductQuery
func (*CostItemProductQuery) WhereNotIn ¶
func (q *CostItemProductQuery) WhereNotIn(column any, values []any) *CostItemProductQuery
func (*CostItemProductQuery) WhereNotNull ¶
func (q *CostItemProductQuery) WhereNotNull(columns ...any) *CostItemProductQuery
func (*CostItemProductQuery) WhereNull ¶
func (q *CostItemProductQuery) WhereNull(columns ...any) *CostItemProductQuery
func (*CostItemProductQuery) WhereRelation ¶
func (q *CostItemProductQuery) WhereRelation(relation string, column any, args ...any) *CostItemProductQuery
func (*CostItemProductQuery) With ¶
func (q *CostItemProductQuery) With(relations ...string) *CostItemProductQuery
func (*CostItemProductQuery) WithAvg ¶
func (q *CostItemProductQuery) WithAvg(relation, column string) *CostItemProductQuery
func (*CostItemProductQuery) WithCount ¶
func (q *CostItemProductQuery) WithCount(relations ...string) *CostItemProductQuery
func (*CostItemProductQuery) WithExists ¶
func (q *CostItemProductQuery) WithExists(relation string) *CostItemProductQuery
func (*CostItemProductQuery) WithMax ¶
func (q *CostItemProductQuery) WithMax(relation, column string) *CostItemProductQuery
func (*CostItemProductQuery) WithMin ¶
func (q *CostItemProductQuery) WithMin(relation, column string) *CostItemProductQuery
func (*CostItemProductQuery) WithSum ¶
func (q *CostItemProductQuery) WithSum(relation, column string) *CostItemProductQuery
func (*CostItemProductQuery) Without ¶
func (q *CostItemProductQuery) Without(relations ...string) *CostItemProductQuery
func (*CostItemProductQuery) WithoutGlobalScope ¶
func (q *CostItemProductQuery) WithoutGlobalScope(identifier string) *CostItemProductQuery
func (*CostItemProductQuery) WithoutGlobalScopes ¶
func (q *CostItemProductQuery) WithoutGlobalScopes(identifiers ...string) *CostItemProductQuery
type CostItemQuery ¶
type CostItemQuery struct {
// contains filtered or unexported fields
}
CostItemQuery is a query on the table of CostItem.
The methods that build return the query, so they chain. The methods that run take a context and an auth.Grant, and return CostItem rows or a value; there is no way to run one without a Grant.
func CostItems ¶
func CostItems(db model.DB) *CostItemQuery
CostItems starts a query on the table of CostItem, through db.
Global scopes are on and, unless the table is Global, every statement is filtered by the tenant of the Grant its terminal takes.
func (*CostItemQuery) AddSelect ¶
func (q *CostItemQuery) AddSelect(columns ...any) *CostItemQuery
func (*CostItemQuery) Base ¶
func (q *CostItemQuery) Base() *model.Builder
Base returns the core builder the query forwards to. It is for code in this package -- a local scope in the custom block of ledger.go -- and for the factory, which builds rows through it.
func (*CostItemQuery) Clone ¶
func (q *CostItemQuery) Clone() *CostItemQuery
Clone returns an independent copy of the query.
func (*CostItemQuery) CursorPaginate ¶
func (q *CostItemQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, opts pagination.Options, columns ...any) (CostItemCollection, *pagination.CursorPage, error)
func (*CostItemQuery) DoesntExist ¶
func (*CostItemQuery) DoesntHave ¶
func (q *CostItemQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *CostItemQuery
func (*CostItemQuery) FindMany ¶
func (q *CostItemQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (CostItemCollection, error)
func (*CostItemQuery) FindOrFail ¶
func (*CostItemQuery) FirstOrCreate ¶
func (*CostItemQuery) FirstOrFail ¶
func (*CostItemQuery) FirstOrNew ¶
func (*CostItemQuery) FirstWhere ¶
func (*CostItemQuery) ForPage ¶
func (q *CostItemQuery) ForPage(page, perPage int) *CostItemQuery
func (*CostItemQuery) ForceCreate ¶
func (*CostItemQuery) Get ¶
func (q *CostItemQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (CostItemCollection, error)
Get runs the query and returns the rows.
func (*CostItemQuery) GroupBy ¶
func (q *CostItemQuery) GroupBy(groups ...any) *CostItemQuery
func (*CostItemQuery) Has ¶
func (q *CostItemQuery) Has(relation, operator string, count int, boolean string, callback func(*query.Builder)) *CostItemQuery
func (*CostItemQuery) InsertOrIgnore ¶
func (*CostItemQuery) Join ¶
func (q *CostItemQuery) Join(table any, first any, args ...any) *CostItemQuery
func (*CostItemQuery) Latest ¶
func (q *CostItemQuery) Latest(column ...string) *CostItemQuery
func (*CostItemQuery) Limit ¶
func (q *CostItemQuery) Limit(value int) *CostItemQuery
func (*CostItemQuery) New ¶
func (q *CostItemQuery) New() (*CostItem, error)
New returns an empty CostItem on the query's connection, not yet saved, filled with what WithAttributes recorded on the query.
func (*CostItemQuery) Offset ¶
func (q *CostItemQuery) Offset(value int) *CostItemQuery
func (*CostItemQuery) Oldest ¶
func (q *CostItemQuery) Oldest(column ...string) *CostItemQuery
func (*CostItemQuery) OrDoesntHave ¶
func (q *CostItemQuery) OrDoesntHave(relation string) *CostItemQuery
func (*CostItemQuery) OrHas ¶
func (q *CostItemQuery) OrHas(relation, operator string, count int) *CostItemQuery
func (*CostItemQuery) OrWhere ¶
func (q *CostItemQuery) OrWhere(column any, args ...any) *CostItemQuery
OrWhere adds an or-where clause; a func(*CostItemQuery) in place of the column adds a group.
func (*CostItemQuery) OrWhereDoesntHave ¶
func (q *CostItemQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *CostItemQuery
func (*CostItemQuery) OrWhereHas ¶
func (q *CostItemQuery) OrWhereHas(relation string, callback func(*query.Builder)) *CostItemQuery
func (*CostItemQuery) OrWhereNot ¶
func (q *CostItemQuery) OrWhereNot(column any, args ...any) *CostItemQuery
OrWhereNot adds an or-joined negated where clause, or a negated group.
func (*CostItemQuery) OrWhereRelation ¶
func (q *CostItemQuery) OrWhereRelation(relation string, column any, args ...any) *CostItemQuery
func (*CostItemQuery) OrderBy ¶
func (q *CostItemQuery) OrderBy(column any, direction ...string) *CostItemQuery
func (*CostItemQuery) OrderByDesc ¶
func (q *CostItemQuery) OrderByDesc(column any) *CostItemQuery
func (*CostItemQuery) Paginate ¶
func (q *CostItemQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (CostItemCollection, *pagination.LengthAwarePage, error)
func (*CostItemQuery) Select ¶
func (q *CostItemQuery) Select(columns ...any) *CostItemQuery
func (*CostItemQuery) SelectRaw ¶
func (q *CostItemQuery) SelectRaw(expression string, bindings ...any) *CostItemQuery
func (*CostItemQuery) SimplePaginate ¶
func (q *CostItemQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (CostItemCollection, *pagination.Page, error)
func (*CostItemQuery) UpdateOrCreate ¶
func (*CostItemQuery) ValueOrFail ¶
func (*CostItemQuery) Where ¶
func (q *CostItemQuery) Where(column any, args ...any) *CostItemQuery
Where adds a where clause; a func(*CostItemQuery) in place of the column adds a group.
func (*CostItemQuery) WhereBelongsTo ¶
func (q *CostItemQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *CostItemQuery
func (*CostItemQuery) WhereBetween ¶
func (q *CostItemQuery) WhereBetween(column any, from, to any) *CostItemQuery
func (*CostItemQuery) WhereColumn ¶
func (q *CostItemQuery) WhereColumn(first any, args ...any) *CostItemQuery
func (*CostItemQuery) WhereDoesntHave ¶
func (q *CostItemQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *CostItemQuery
func (*CostItemQuery) WhereExists ¶
func (q *CostItemQuery) WhereExists(callback func(*query.Builder)) *CostItemQuery
func (*CostItemQuery) WhereHas ¶
func (q *CostItemQuery) WhereHas(relation string, callback func(*query.Builder)) *CostItemQuery
func (*CostItemQuery) WhereHasCount ¶
func (q *CostItemQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *CostItemQuery
func (*CostItemQuery) WhereIn ¶
func (q *CostItemQuery) WhereIn(column any, values []any) *CostItemQuery
func (*CostItemQuery) WhereKey ¶
func (q *CostItemQuery) WhereKey(id any) *CostItemQuery
func (*CostItemQuery) WhereNot ¶
func (q *CostItemQuery) WhereNot(column any, args ...any) *CostItemQuery
WhereNot adds a negated where clause, or a negated group.
func (*CostItemQuery) WhereNotExists ¶
func (q *CostItemQuery) WhereNotExists(callback func(*query.Builder)) *CostItemQuery
func (*CostItemQuery) WhereNotIn ¶
func (q *CostItemQuery) WhereNotIn(column any, values []any) *CostItemQuery
func (*CostItemQuery) WhereNotNull ¶
func (q *CostItemQuery) WhereNotNull(columns ...any) *CostItemQuery
func (*CostItemQuery) WhereNull ¶
func (q *CostItemQuery) WhereNull(columns ...any) *CostItemQuery
func (*CostItemQuery) WhereRelation ¶
func (q *CostItemQuery) WhereRelation(relation string, column any, args ...any) *CostItemQuery
func (*CostItemQuery) With ¶
func (q *CostItemQuery) With(relations ...string) *CostItemQuery
func (*CostItemQuery) WithAvg ¶
func (q *CostItemQuery) WithAvg(relation, column string) *CostItemQuery
func (*CostItemQuery) WithCount ¶
func (q *CostItemQuery) WithCount(relations ...string) *CostItemQuery
func (*CostItemQuery) WithExists ¶
func (q *CostItemQuery) WithExists(relation string) *CostItemQuery
func (*CostItemQuery) WithMax ¶
func (q *CostItemQuery) WithMax(relation, column string) *CostItemQuery
func (*CostItemQuery) WithMin ¶
func (q *CostItemQuery) WithMin(relation, column string) *CostItemQuery
func (*CostItemQuery) WithSum ¶
func (q *CostItemQuery) WithSum(relation, column string) *CostItemQuery
func (*CostItemQuery) Without ¶
func (q *CostItemQuery) Without(relations ...string) *CostItemQuery
func (*CostItemQuery) WithoutGlobalScope ¶
func (q *CostItemQuery) WithoutGlobalScope(identifier string) *CostItemQuery
func (*CostItemQuery) WithoutGlobalScopes ¶
func (q *CostItemQuery) WithoutGlobalScopes(identifiers ...string) *CostItemQuery
type CostRequest ¶
type CostRequest struct {
Name string
Category string
Amount int64
Recurrence Recurrence
StartsOn string
EndsOn string
AllProducts bool
Products []string
}
CostRequest declares one cost of running the application.
func (CostRequest) Validate ¶
func (r CostRequest) Validate() validation.Errors
Validate reports the errors per field.
type CostRow ¶
type CostRow struct {
ID, Name, Category, Amount, Recurrence, Starts, Ends, Scope, EndURL string
Ended bool
}
CostRow is one declared cost.
type CreateRequest ¶
type CreateRequest struct {
// UserID is the login user who is this investor.
UserID string
// Kind is Person or Company.
Kind PersonKind
// Document is the CPF or the CNPJ, formatted or not.
Document string
// Name is the person's name, or the company's trade name.
Name string
// LegalName is the company's registered name. Required for a company.
LegalName string
// LegalRepresentative is who signs for the company. Required for a company.
LegalRepresentative string
// Email is where the investor is reached.
Email string
}
CreateRequest is the input contract for registering an investor.
The fields are explicit and there is no mass assignment, so a request body cannot write a column nobody meant to expose. There is no TenantID here and there must never be one: the tenant comes from the Grant, which comes from the session.
func (CreateRequest) Validate ¶
func (r CreateRequest) Validate() validation.Errors
Validate reports the errors per field.
type DashboardPageData ¶
type DashboardPageData struct {
Screen
Investor string
Document string
Available, Held, ReceivedYear, WithdrawnTotal string
Contracts []ContractRow
Invoices []InvoiceRow
Accounts []AccountOption
Year, Month int
// ReportsURL is the base of the reports; PixURL, the address a payout
// account is declared at, is the same as PayoutAccountsURL and kept for a
// published view that still reads it.
ReportsURL, PixURL, PayoutAccountsURL string
// ReportMonths and ReportYears are the reports offered: none before the
// investor's first contract started.
ReportMonths, ReportYears []ReportLink
}
DashboardPageData is the investor's own panel.
type Day ¶
type Day string
Day is a calendar day, stored as YYYY-MM-DD.
A day and not a timestamp, because a contract starts on the 20th in the customer's calendar, not at an instant in some timezone, and a timestamp column turns that into a different day on every server that reads it in another zone. The empty Day is "no day", which is how an open end is kept.
func (Day) Before ¶
Before reports whether d is earlier than other. An unset day is never before anything.
type EntriesQuery ¶
type EntriesQuery struct {
Search string
Kind EntryKind
Sort string
Dir string
Page int
PerPage int
}
EntriesQuery narrows the admin's books. Page counts from one.
type Entry ¶
type Entry struct {
model.Model
ID string `db:"id"`
TenantID string `db:"tenant_id"`
// ProductID is the application's product the money belongs to.
ProductID string `db:"product_id"`
// Kind is what the entry is.
Kind EntryKind `db:"kind"`
// OccurredAt is when it happened, and OccurredOn the calendar day of that
// instant in the application's timezone -- the day the periods count by.
OccurredAt time.Time `db:"occurred_at"`
OccurredOn Day `db:"occurred_on"`
// Gross and Fee are centavos. Net is Gross - Fee, stored so a statement
// sums one column.
Gross int64 `db:"gross"`
Fee int64 `db:"fee"`
Net int64 `db:"net"`
// FeeDetail says what the fee was: "gateway", "invoice", "withdrawal".
FeeDetail string `db:"fee_detail"`
Description string `db:"description"`
// Source is where the entry came from: the application's code, or the
// admin by hand.
Source EntrySource `db:"source"`
// ExternalRef is the caller's identifier of the event, unique per tenant:
// sending the same event twice records it once.
ExternalRef string `db:"external_ref"`
// ReversesID is the entry a reversal undoes. Empty on every other kind.
ReversesID string `db:"reverses_id"`
CreatedBy string `db:"created_by"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
Entry is one movement of the application's money that the investors' statements are made of: a sale, a renewal, a refund, a fee, an expense, a tax, an adjustment, or the reversal of one of them.
Money is in centavos, signed: Gross is what the entry adds to the revenue (negative for a refund), Fee is what was taken from it on the way (the gateway, the invoice issuer, a tax). The net of the entry is Gross - Fee.
An entry is never edited. A wrong one is undone by a reversal, a new entry that names it and carries the opposite amounts, so the statement of a closed period never changes after it was closed.
func (*Entry) Fresh ¶
Fresh reads the row again, as a new Entry; it shadows the untyped one the embedded model promotes.
type EntryCollection ¶
type EntryCollection []*Entry
EntryCollection is rows of Entry, as a query returns them.
func EntryCollectionOf ¶
func EntryCollectionOf(rows model.Rows) EntryCollection
EntryCollectionOf converts rows of the table of Entry. A nil input is a nil collection.
func (EntryCollection) Contains ¶
func (c EntryCollection) Contains(key any) bool
func (EntryCollection) Except ¶
func (c EntryCollection) Except(keys ...any) EntryCollection
func (EntryCollection) Find ¶
func (c EntryCollection) Find(key any) *Entry
func (EntryCollection) FindOrFail ¶
func (c EntryCollection) FindOrFail(key any) (*Entry, error)
func (EntryCollection) Fresh ¶
func (c EntryCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (EntryCollection, error)
func (EntryCollection) LoadMissing ¶
func (EntryCollection) ModelKeys ¶
func (c EntryCollection) ModelKeys() []any
func (EntryCollection) Only ¶
func (c EntryCollection) Only(keys ...any) EntryCollection
func (EntryCollection) Pluck ¶
func (c EntryCollection) Pluck(column string) []any
func (EntryCollection) Rows ¶
func (c EntryCollection) Rows() model.Rows
Rows converts the collection back to the core's rows.
func (EntryCollection) ToArray ¶
func (c EntryCollection) ToArray() []map[string]any
func (EntryCollection) Unique ¶
func (c EntryCollection) Unique() EntryCollection
type EntryKind ¶
type EntryKind string
EntryKind is what an entry is.
const ( // KindSale is a first purchase. KindSale EntryKind = "sale" // KindRenewal is a recurring payment of something already sold. KindRenewal EntryKind = "renewal" // KindRefund is money given back to a buyer: negative revenue. KindRefund EntryKind = "refund" // KindFee is a charge taken on the way that is not tied to one sale. KindFee EntryKind = "fee" // KindExpense is money spent that is not one of the declared costs. KindExpense EntryKind = "expense" // KindTax is a tax paid. KindTax EntryKind = "tax" // KindAdjustment corrects the revenue by hand, either way. KindAdjustment EntryKind = "adjustment" // KindReversal undoes another entry. KindReversal EntryKind = "reversal" )
type EntryQuery ¶
type EntryQuery struct {
// contains filtered or unexported fields
}
EntryQuery is a query on the table of Entry.
The methods that build return the query, so they chain. The methods that run take a context and an auth.Grant, and return Entry rows or a value; there is no way to run one without a Grant.
func Entries ¶
func Entries(db model.DB) *EntryQuery
Entries starts a query on the table of Entry, through db.
Global scopes are on and, unless the table is Global, every statement is filtered by the tenant of the Grant its terminal takes.
func (*EntryQuery) AddSelect ¶
func (q *EntryQuery) AddSelect(columns ...any) *EntryQuery
func (*EntryQuery) Base ¶
func (q *EntryQuery) Base() *model.Builder
Base returns the core builder the query forwards to. It is for code in this package -- a local scope in the custom block of ledger.go -- and for the factory, which builds rows through it.
func (*EntryQuery) Clone ¶
func (q *EntryQuery) Clone() *EntryQuery
Clone returns an independent copy of the query.
func (*EntryQuery) CursorPaginate ¶
func (q *EntryQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, opts pagination.Options, columns ...any) (EntryCollection, *pagination.CursorPage, error)
func (*EntryQuery) DoesntExist ¶
func (*EntryQuery) DoesntHave ¶
func (q *EntryQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *EntryQuery
func (*EntryQuery) FindMany ¶
func (q *EntryQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (EntryCollection, error)
func (*EntryQuery) FindOrFail ¶
func (*EntryQuery) FirstOrCreate ¶
func (*EntryQuery) FirstOrFail ¶
func (*EntryQuery) FirstOrNew ¶
func (*EntryQuery) FirstWhere ¶
func (*EntryQuery) ForPage ¶
func (q *EntryQuery) ForPage(page, perPage int) *EntryQuery
func (*EntryQuery) ForceCreate ¶
func (*EntryQuery) Get ¶
func (q *EntryQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (EntryCollection, error)
Get runs the query and returns the rows.
func (*EntryQuery) GroupBy ¶
func (q *EntryQuery) GroupBy(groups ...any) *EntryQuery
func (*EntryQuery) Has ¶
func (q *EntryQuery) Has(relation, operator string, count int, boolean string, callback func(*query.Builder)) *EntryQuery
func (*EntryQuery) InsertOrIgnore ¶
func (*EntryQuery) Join ¶
func (q *EntryQuery) Join(table any, first any, args ...any) *EntryQuery
func (*EntryQuery) Latest ¶
func (q *EntryQuery) Latest(column ...string) *EntryQuery
func (*EntryQuery) Limit ¶
func (q *EntryQuery) Limit(value int) *EntryQuery
func (*EntryQuery) New ¶
func (q *EntryQuery) New() (*Entry, error)
New returns an empty Entry on the query's connection, not yet saved, filled with what WithAttributes recorded on the query.
func (*EntryQuery) Offset ¶
func (q *EntryQuery) Offset(value int) *EntryQuery
func (*EntryQuery) Oldest ¶
func (q *EntryQuery) Oldest(column ...string) *EntryQuery
func (*EntryQuery) OrDoesntHave ¶
func (q *EntryQuery) OrDoesntHave(relation string) *EntryQuery
func (*EntryQuery) OrHas ¶
func (q *EntryQuery) OrHas(relation, operator string, count int) *EntryQuery
func (*EntryQuery) OrWhere ¶
func (q *EntryQuery) OrWhere(column any, args ...any) *EntryQuery
OrWhere adds an or-where clause; a func(*EntryQuery) in place of the column adds a group.
func (*EntryQuery) OrWhereDoesntHave ¶
func (q *EntryQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *EntryQuery
func (*EntryQuery) OrWhereHas ¶
func (q *EntryQuery) OrWhereHas(relation string, callback func(*query.Builder)) *EntryQuery
func (*EntryQuery) OrWhereNot ¶
func (q *EntryQuery) OrWhereNot(column any, args ...any) *EntryQuery
OrWhereNot adds an or-joined negated where clause, or a negated group.
func (*EntryQuery) OrWhereRelation ¶
func (q *EntryQuery) OrWhereRelation(relation string, column any, args ...any) *EntryQuery
func (*EntryQuery) OrderBy ¶
func (q *EntryQuery) OrderBy(column any, direction ...string) *EntryQuery
func (*EntryQuery) OrderByDesc ¶
func (q *EntryQuery) OrderByDesc(column any) *EntryQuery
func (*EntryQuery) Paginate ¶
func (q *EntryQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (EntryCollection, *pagination.LengthAwarePage, error)
func (*EntryQuery) Select ¶
func (q *EntryQuery) Select(columns ...any) *EntryQuery
func (*EntryQuery) SelectRaw ¶
func (q *EntryQuery) SelectRaw(expression string, bindings ...any) *EntryQuery
func (*EntryQuery) SimplePaginate ¶
func (q *EntryQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (EntryCollection, *pagination.Page, error)
func (*EntryQuery) UpdateOrCreate ¶
func (*EntryQuery) ValueOrFail ¶
func (*EntryQuery) Where ¶
func (q *EntryQuery) Where(column any, args ...any) *EntryQuery
Where adds a where clause; a func(*EntryQuery) in place of the column adds a group.
func (*EntryQuery) WhereBelongsTo ¶
func (q *EntryQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *EntryQuery
func (*EntryQuery) WhereBetween ¶
func (q *EntryQuery) WhereBetween(column any, from, to any) *EntryQuery
func (*EntryQuery) WhereColumn ¶
func (q *EntryQuery) WhereColumn(first any, args ...any) *EntryQuery
func (*EntryQuery) WhereDoesntHave ¶
func (q *EntryQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *EntryQuery
func (*EntryQuery) WhereExists ¶
func (q *EntryQuery) WhereExists(callback func(*query.Builder)) *EntryQuery
func (*EntryQuery) WhereHas ¶
func (q *EntryQuery) WhereHas(relation string, callback func(*query.Builder)) *EntryQuery
func (*EntryQuery) WhereHasCount ¶
func (q *EntryQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *EntryQuery
func (*EntryQuery) WhereIn ¶
func (q *EntryQuery) WhereIn(column any, values []any) *EntryQuery
func (*EntryQuery) WhereKey ¶
func (q *EntryQuery) WhereKey(id any) *EntryQuery
func (*EntryQuery) WhereNot ¶
func (q *EntryQuery) WhereNot(column any, args ...any) *EntryQuery
WhereNot adds a negated where clause, or a negated group.
func (*EntryQuery) WhereNotExists ¶
func (q *EntryQuery) WhereNotExists(callback func(*query.Builder)) *EntryQuery
func (*EntryQuery) WhereNotIn ¶
func (q *EntryQuery) WhereNotIn(column any, values []any) *EntryQuery
func (*EntryQuery) WhereNotNull ¶
func (q *EntryQuery) WhereNotNull(columns ...any) *EntryQuery
func (*EntryQuery) WhereNull ¶
func (q *EntryQuery) WhereNull(columns ...any) *EntryQuery
func (*EntryQuery) WhereRelation ¶
func (q *EntryQuery) WhereRelation(relation string, column any, args ...any) *EntryQuery
func (*EntryQuery) With ¶
func (q *EntryQuery) With(relations ...string) *EntryQuery
func (*EntryQuery) WithAvg ¶
func (q *EntryQuery) WithAvg(relation, column string) *EntryQuery
func (*EntryQuery) WithCount ¶
func (q *EntryQuery) WithCount(relations ...string) *EntryQuery
func (*EntryQuery) WithExists ¶
func (q *EntryQuery) WithExists(relation string) *EntryQuery
func (*EntryQuery) WithMax ¶
func (q *EntryQuery) WithMax(relation, column string) *EntryQuery
func (*EntryQuery) WithMin ¶
func (q *EntryQuery) WithMin(relation, column string) *EntryQuery
func (*EntryQuery) WithSum ¶
func (q *EntryQuery) WithSum(relation, column string) *EntryQuery
func (*EntryQuery) Without ¶
func (q *EntryQuery) Without(relations ...string) *EntryQuery
func (*EntryQuery) WithoutGlobalScope ¶
func (q *EntryQuery) WithoutGlobalScope(identifier string) *EntryQuery
func (*EntryQuery) WithoutGlobalScopes ¶
func (q *EntryQuery) WithoutGlobalScopes(identifiers ...string) *EntryQuery
type EntryRequest ¶
type EntryRequest struct {
// ExternalRef identifies the event in the caller's system. Sending the same
// one twice records it once and answers the entry already recorded.
ExternalRef string
Kind EntryKind
ProductID string
OccurredAt time.Time
// Gross is centavos of revenue: positive for a sale, a renewal or an
// adjustment up, negative for a refund or an adjustment down. Zero for a
// fee, an expense or a tax.
Gross int64
// Fee is centavos taken on the way: the gateway's cut of a sale, or the
// whole amount of a fee, an expense or a tax.
Fee int64
FeeDetail string
Description string
}
EntryRequest is one event the application reports: a sale, a renewal, a refund, a fee, an expense or a tax. It is what the application's own events endpoint -- which it owns, with its own token per tenant -- turns its body into before calling RecordEntry.
func (EntryRequest) Validate ¶
func (r EntryRequest) Validate() validation.Errors
Validate reports the errors per field.
type EntryRow ¶
type EntryRow struct {
ID, Day, Product, Kind, Description, Gross, Fee, Net, Source, Ref, ReverseURL string
Reversible bool
GrossSort, DaySort string
}
EntryRow is one entry in the admin's books.
type EntrySource ¶
type EntrySource string
EntrySource is where an entry came from.
const ( // SourceAPI is the application's code, through RecordEntry. SourceAPI EntrySource = "api" // SourceManual is the admin, by hand. SourceManual EntrySource = "manual" )
type Figures ¶
type Figures struct {
Gross int64
Fees int64
Costs int64
Net int64
CostRatioPPM int64
Amount int64
}
Figures are the numbers one closing of one contract comes to.
func ComputeFigures ¶
ComputeFigures turns the contract's gross, fees and allocated costs into the net and the investor's amount. A net of zero or less gives no amount.
type Flag ¶
type Flag bool
Flag is a yes-or-no a column holds as an integer, read back from whatever an engine answers with -- the same arrangement arandu-wallet keeps, because the engines disagree about booleans and one place has to flatten them.
type FormState ¶
FormState is what a form field reads from the page it is drawn on: what was typed before a refusal, and the message for each field.
func (FormState) ErrorSummary ¶ added in v0.2.0
ErrorSummary is one line per rejected field.
func (FormState) FieldError ¶
FieldError is the first message for one field, empty when it was accepted.
func (FormState) FieldErrors ¶ added in v0.2.0
FieldErrors is every message for one field.
func (FormState) HasErrors ¶ added in v0.2.0
HasErrors says whether the attempt that landed here was rejected.
func (FormState) LogValue ¶ added in v0.2.0
LogValue is the form state as a log line carries it, the token redacted.
func (FormState) MarshalJSON ¶ added in v0.2.0
MarshalJSON writes the form state with the CSRF token redacted.
type Investor ¶
type Investor struct {
model.Model
// ID is the identifier. It is generated by the application rather than by
// the database, because a DEFAULT that produces a uuid is spelled
// differently in every engine.
ID string `db:"id"`
// TenantID is the customer the row belongs to. It is written from the
// Grant and read back so the policy can compare it against the subject's
// tenant.
TenantID string `db:"tenant_id"`
// UserID is the login user who is this investor. The application owns what
// a user is; this package only compares the identifier with the subject's.
UserID string `db:"user_id"`
// Kind says whether the investor is a person or a company, which decides
// which document is valid and which names are required.
Kind PersonKind `db:"person_kind"`
// Document is the CPF of a person or the CNPJ of a company, digits only
// (and letters, for the alphanumeric CNPJ), never formatted.
Document string `db:"document"`
// Name is the person's name, or the company's trade name.
Name string `db:"name"`
// LegalName is the company's registered name. Empty for a person.
LegalName string `db:"legal_name"`
// LegalRepresentative is who signs for the company. Empty for a person.
LegalRepresentative string `db:"legal_representative"`
// Email is where the investor is reached about invoices and payments.
Email string `db:"email"`
// Status is whether the investor is active. A suspended investor keeps the
// history and earns nothing new.
Status InvestorStatus `db:"status"`
// CreatedAt is when the row was written, in UTC.
CreatedAt time.Time `db:"created_at"`
// UpdatedAt is when the row last changed, in UTC.
UpdatedAt time.Time `db:"updated_at"`
}
Investor is one angel investor of the application: a person (CPF) or a company (CNPJ) the finance team registered, tied to the login user who reads the statement.
It embeds the model, so a row returned by a query carries the connection and can be saved again. Build a new row with Investors(db).New(): a struct literal has no connection and its write methods return model.ErrUnwired.
Investors, InvestorQuery and InvestorCollection are generated beside this file, in InvestorQuery.go, by aru model:build.
func (Investor) DisplayName ¶
DisplayName is the name the screens print: the registered name of a company when there is one, the person's name otherwise.
func (*Investor) Fresh ¶
Fresh reads the row again, as a new Investor; it shadows the untyped one the embedded model promotes.
func (*Investor) Reactivate ¶
Reactivate brings a suspended investor back into new closings.
type InvestorCollection ¶
type InvestorCollection []*Investor
InvestorCollection is rows of Investor, as a query returns them.
func InvestorCollectionOf ¶
func InvestorCollectionOf(rows model.Rows) InvestorCollection
InvestorCollectionOf converts rows of the table of Investor. A nil input is a nil collection.
func (InvestorCollection) Contains ¶
func (c InvestorCollection) Contains(key any) bool
func (InvestorCollection) Except ¶
func (c InvestorCollection) Except(keys ...any) InvestorCollection
func (InvestorCollection) Find ¶
func (c InvestorCollection) Find(key any) *Investor
func (InvestorCollection) FindOrFail ¶
func (c InvestorCollection) FindOrFail(key any) (*Investor, error)
func (InvestorCollection) Fresh ¶
func (c InvestorCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (InvestorCollection, error)
func (InvestorCollection) LoadMissing ¶
func (InvestorCollection) ModelKeys ¶
func (c InvestorCollection) ModelKeys() []any
func (InvestorCollection) Only ¶
func (c InvestorCollection) Only(keys ...any) InvestorCollection
func (InvestorCollection) Pluck ¶
func (c InvestorCollection) Pluck(column string) []any
func (InvestorCollection) Rows ¶
func (c InvestorCollection) Rows() model.Rows
Rows converts the collection back to the core's rows.
func (InvestorCollection) ToArray ¶
func (c InvestorCollection) ToArray() []map[string]any
func (InvestorCollection) Unique ¶
func (c InvestorCollection) Unique() InvestorCollection
type InvestorPolicy ¶
type InvestorPolicy struct{}
InvestorPolicy is the only authority over who does what with an Investor and everything that belongs to one: contracts, statement, invoices.
It denies unless a rule below says otherwise, and the rules are written around two subjects: the investor, who may read what is theirs, and the admin, who may act across the tenant. Everything else -- a guest, a subject from another tenant, a signed-in person reaching for somebody else's statement -- falls through to the refusal at the end.
func (InvestorPolicy) Can ¶
func (InvestorPolicy) Can(ctx context.Context, s security.Subject, a security.Action, record Investor) error
Can decides whether the subject may perform the action on the record.
It is the only place that decides. The service reaches the Model only after Authorize turns this method's nil result into a Grant.
The record is the empty Investor where the question is "may this subject do this kind of thing at all", and the loaded row where it is "may they do it to this investor". Both are asked, in that order, and the second is what a rule about ownership answers.
func (InvestorPolicy) Writes ¶ added in v0.4.0
func (InvestorPolicy) Writes(a security.Action) bool
Writes reports whether a Grant issued for the action may change anything.
Reading the statement, the costs and the projection (DashboardView) and reading or downloading a contract (ContractView) change nothing, so the Grants issued for them only read: the database refuses an insert, update or delete made with one, whatever the code holding it does next.
ReportsView writes. It is also the action under which an investor asks for their own money -- declaring a payout account and withdrawing an invoice -- and both record the request and an activity entry with that Grant.
Everything not named as a read writes, the management actions with it, so an action added later behaves as every action did before this method existed until somebody decides it only reads.
type InvestorQuery ¶
type InvestorQuery struct {
// contains filtered or unexported fields
}
InvestorQuery is a query on the table of Investor.
The methods that build return the query, so they chain. The methods that run take a context and an auth.Grant, and return Investor rows or a value; there is no way to run one without a Grant.
func Investors ¶
func Investors(db model.DB) *InvestorQuery
Investors starts a query on the table of Investor, through db.
Global scopes are on and, unless the table is Global, every statement is filtered by the tenant of the Grant its terminal takes.
func (*InvestorQuery) AddSelect ¶
func (q *InvestorQuery) AddSelect(columns ...any) *InvestorQuery
func (*InvestorQuery) Base ¶
func (q *InvestorQuery) Base() *model.Builder
Base returns the core builder the query forwards to. It is for code in this package -- a local scope in the custom block of model.go -- and for the factory, which builds rows through it.
func (*InvestorQuery) Clone ¶
func (q *InvestorQuery) Clone() *InvestorQuery
Clone returns an independent copy of the query.
func (*InvestorQuery) CursorPaginate ¶
func (q *InvestorQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, opts pagination.Options, columns ...any) (InvestorCollection, *pagination.CursorPage, error)
func (*InvestorQuery) DoesntExist ¶
func (*InvestorQuery) DoesntHave ¶
func (q *InvestorQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *InvestorQuery
func (*InvestorQuery) FindMany ¶
func (q *InvestorQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (InvestorCollection, error)
func (*InvestorQuery) FindOrFail ¶
func (*InvestorQuery) FirstOrCreate ¶
func (*InvestorQuery) FirstOrFail ¶
func (*InvestorQuery) FirstOrNew ¶
func (*InvestorQuery) FirstWhere ¶
func (*InvestorQuery) ForPage ¶
func (q *InvestorQuery) ForPage(page, perPage int) *InvestorQuery
func (*InvestorQuery) ForceCreate ¶
func (*InvestorQuery) Get ¶
func (q *InvestorQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (InvestorCollection, error)
Get runs the query and returns the rows.
func (*InvestorQuery) GroupBy ¶
func (q *InvestorQuery) GroupBy(groups ...any) *InvestorQuery
func (*InvestorQuery) Has ¶
func (q *InvestorQuery) Has(relation, operator string, count int, boolean string, callback func(*query.Builder)) *InvestorQuery
func (*InvestorQuery) InsertOrIgnore ¶
func (*InvestorQuery) Join ¶
func (q *InvestorQuery) Join(table any, first any, args ...any) *InvestorQuery
func (*InvestorQuery) Latest ¶
func (q *InvestorQuery) Latest(column ...string) *InvestorQuery
func (*InvestorQuery) Limit ¶
func (q *InvestorQuery) Limit(value int) *InvestorQuery
func (*InvestorQuery) New ¶
func (q *InvestorQuery) New() (*Investor, error)
New returns an empty Investor on the query's connection, not yet saved, filled with what WithAttributes recorded on the query.
func (*InvestorQuery) Offset ¶
func (q *InvestorQuery) Offset(value int) *InvestorQuery
func (*InvestorQuery) Oldest ¶
func (q *InvestorQuery) Oldest(column ...string) *InvestorQuery
func (*InvestorQuery) OrDoesntHave ¶
func (q *InvestorQuery) OrDoesntHave(relation string) *InvestorQuery
func (*InvestorQuery) OrHas ¶
func (q *InvestorQuery) OrHas(relation, operator string, count int) *InvestorQuery
func (*InvestorQuery) OrWhere ¶
func (q *InvestorQuery) OrWhere(column any, args ...any) *InvestorQuery
OrWhere adds an or-where clause; a func(*InvestorQuery) in place of the column adds a group.
func (*InvestorQuery) OrWhereDoesntHave ¶
func (q *InvestorQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *InvestorQuery
func (*InvestorQuery) OrWhereHas ¶
func (q *InvestorQuery) OrWhereHas(relation string, callback func(*query.Builder)) *InvestorQuery
func (*InvestorQuery) OrWhereNot ¶
func (q *InvestorQuery) OrWhereNot(column any, args ...any) *InvestorQuery
OrWhereNot adds an or-joined negated where clause, or a negated group.
func (*InvestorQuery) OrWhereRelation ¶
func (q *InvestorQuery) OrWhereRelation(relation string, column any, args ...any) *InvestorQuery
func (*InvestorQuery) OrderBy ¶
func (q *InvestorQuery) OrderBy(column any, direction ...string) *InvestorQuery
func (*InvestorQuery) OrderByDesc ¶
func (q *InvestorQuery) OrderByDesc(column any) *InvestorQuery
func (*InvestorQuery) Paginate ¶
func (q *InvestorQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (InvestorCollection, *pagination.LengthAwarePage, error)
func (*InvestorQuery) Select ¶
func (q *InvestorQuery) Select(columns ...any) *InvestorQuery
func (*InvestorQuery) SelectRaw ¶
func (q *InvestorQuery) SelectRaw(expression string, bindings ...any) *InvestorQuery
func (*InvestorQuery) SimplePaginate ¶
func (q *InvestorQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (InvestorCollection, *pagination.Page, error)
func (*InvestorQuery) UpdateOrCreate ¶
func (*InvestorQuery) ValueOrFail ¶
func (*InvestorQuery) Where ¶
func (q *InvestorQuery) Where(column any, args ...any) *InvestorQuery
Where adds a where clause; a func(*InvestorQuery) in place of the column adds a group.
func (*InvestorQuery) WhereBelongsTo ¶
func (q *InvestorQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *InvestorQuery
func (*InvestorQuery) WhereBetween ¶
func (q *InvestorQuery) WhereBetween(column any, from, to any) *InvestorQuery
func (*InvestorQuery) WhereColumn ¶
func (q *InvestorQuery) WhereColumn(first any, args ...any) *InvestorQuery
func (*InvestorQuery) WhereDoesntHave ¶
func (q *InvestorQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *InvestorQuery
func (*InvestorQuery) WhereExists ¶
func (q *InvestorQuery) WhereExists(callback func(*query.Builder)) *InvestorQuery
func (*InvestorQuery) WhereHas ¶
func (q *InvestorQuery) WhereHas(relation string, callback func(*query.Builder)) *InvestorQuery
func (*InvestorQuery) WhereHasCount ¶
func (q *InvestorQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *InvestorQuery
func (*InvestorQuery) WhereIn ¶
func (q *InvestorQuery) WhereIn(column any, values []any) *InvestorQuery
func (*InvestorQuery) WhereKey ¶
func (q *InvestorQuery) WhereKey(id any) *InvestorQuery
func (*InvestorQuery) WhereNot ¶
func (q *InvestorQuery) WhereNot(column any, args ...any) *InvestorQuery
WhereNot adds a negated where clause, or a negated group.
func (*InvestorQuery) WhereNotExists ¶
func (q *InvestorQuery) WhereNotExists(callback func(*query.Builder)) *InvestorQuery
func (*InvestorQuery) WhereNotIn ¶
func (q *InvestorQuery) WhereNotIn(column any, values []any) *InvestorQuery
func (*InvestorQuery) WhereNotNull ¶
func (q *InvestorQuery) WhereNotNull(columns ...any) *InvestorQuery
func (*InvestorQuery) WhereNull ¶
func (q *InvestorQuery) WhereNull(columns ...any) *InvestorQuery
func (*InvestorQuery) WhereRelation ¶
func (q *InvestorQuery) WhereRelation(relation string, column any, args ...any) *InvestorQuery
func (*InvestorQuery) With ¶
func (q *InvestorQuery) With(relations ...string) *InvestorQuery
func (*InvestorQuery) WithAvg ¶
func (q *InvestorQuery) WithAvg(relation, column string) *InvestorQuery
func (*InvestorQuery) WithCount ¶
func (q *InvestorQuery) WithCount(relations ...string) *InvestorQuery
func (*InvestorQuery) WithExists ¶
func (q *InvestorQuery) WithExists(relation string) *InvestorQuery
func (*InvestorQuery) WithMax ¶
func (q *InvestorQuery) WithMax(relation, column string) *InvestorQuery
func (*InvestorQuery) WithMin ¶
func (q *InvestorQuery) WithMin(relation, column string) *InvestorQuery
func (*InvestorQuery) WithSum ¶
func (q *InvestorQuery) WithSum(relation, column string) *InvestorQuery
func (*InvestorQuery) Without ¶
func (q *InvestorQuery) Without(relations ...string) *InvestorQuery
func (*InvestorQuery) WithoutGlobalScope ¶
func (q *InvestorQuery) WithoutGlobalScope(identifier string) *InvestorQuery
func (*InvestorQuery) WithoutGlobalScopes ¶
func (q *InvestorQuery) WithoutGlobalScopes(identifiers ...string) *InvestorQuery
type InvestorRow ¶
InvestorRow is one investor in the admin's registry.
type InvestorService ¶
type InvestorService struct {
// contains filtered or unexported fields
}
InvestorService orchestrates the use cases of this package: it validates the request, asks the policy for a Grant, applies the rules the entities hold for themselves, and persists with that Grant.
It receives its collaborators through the constructor. There is no container and no resolution by reflection: what this service is made of is written at the one place that builds it, and reading that place is how somebody learns what the package touches.
Everything a handler is allowed to do goes through here. The service is the only owner of the database handle, so the request layer cannot reach a Model before the policy has answered.
func NewInvestorService ¶
func NewInvestorService(db *data.DB) *InvestorService
NewInvestorService wires the service over the application's database handle.
func (*InvestorService) AddBankAccount ¶ added in v0.2.0
func (s *InvestorService) AddBankAccount(ctx context.Context, actor security.Subject, in BankAccountRequest) (*wallet.PayoutAccount, error)
AddBankAccount declares a bank account the investor who is asking is paid into, in the name and the document of their registration, as AddPixAccount does for a PIX key.
func (*InvestorService) AddPixAccount ¶
func (s *InvestorService) AddPixAccount(ctx context.Context, actor security.Subject, keyType, key string) (*wallet.PayoutAccount, error)
AddPixAccount declares a PIX key the investor who is asking is paid into, in the name and the document of their registration: an investor is paid into an account of their own, never a third party's.
func (*InvestorService) AdminCosts ¶
func (s *InvestorService) AdminCosts(ctx context.Context, actor security.Subject) ([]CostView, error)
AdminCosts lists the declared costs for the admin who declares them.
func (*InvestorService) AmendContract ¶
func (s *InvestorService) AmendContract(ctx context.Context, actor security.Subject, contractID string, in ContractRequest, file io.Reader) (*Contract, error)
AmendContract registers an amendment: a new version of the contract named, with its own terms and file. The version in force becomes superseded in the same transaction, so there is never a moment with two versions in force or with none.
func (*InvestorService) AnnualReport ¶
func (s *InvestorService) AnnualReport(ctx context.Context, actor security.Subject, investorID string, year int, w io.Writer) error
AnnualReport writes the year's income report of one investor as .xlsx: the payer, the beneficiary, and the amounts credited month by month, laid out the way the Receita Federal's informe de rendimentos is. Nothing is withheld by this package, and the report says so.
func (*InvestorService) Close ¶
func (s *InvestorService) Close(ctx context.Context, actor security.Subject, contractID string, asOf Day) (*Invoice, error)
Close closes the period of one contract that ended on the last billing day on or before asOf, and answers the invoice it produced.
The period starts where the last invoice of the contract ended, or on the day the contract started. The entries counted are those of the contract's products not counted before -- which is how an entry dated in a closed period is counted in the next closing instead of reopening the old one. The costs are those of the period's window, shared out over the revenue.
Closing the same period twice answers the invoice the first closing made.
func (*InvestorService) CloseDue ¶
func (s *InvestorService) CloseDue(ctx context.Context, actor security.Subject, asOf Day) ([]*Invoice, map[string]error, error)
CloseDue closes every contract whose billing day is asOf's day: the admin's "close the contracts that are due today". A contract that fails is reported beside the others, and does not stop them.
func (*InvestorService) ContractFile ¶
func (s *InvestorService) ContractFile(ctx context.Context, actor security.Subject, contractID string) (*Contract, filesystem.File, error)
ContractFile opens the signed file of one contract version. The admin may open any; an investor only their own. The caller closes the body.
func (*InvestorService) Costs ¶
Costs lists the declared costs, for the admin and for the investors: what the money is spent on is part of what an investor is shown.
func (*InvestorService) Create ¶
func (s *InvestorService) Create(ctx context.Context, actor security.Subject, in CreateRequest) (*Investor, error)
Create registers an investor: validate, authorize, then act with the Grant the authorization produced.
The candidate is authorized before it is stored, and the candidate is what the policy sees -- so a rule about what may be created is a rule about the record being created, and not about the person alone.
func (*InvestorService) CreateContract ¶
func (s *InvestorService) CreateContract(ctx context.Context, actor security.Subject, investorID string, in ContractRequest, file io.Reader) (*Contract, error)
CreateContract registers the original version of a contract for an investor, with the signed file.
func (*InvestorService) CreateCost ¶
func (s *InvestorService) CreateCost(ctx context.Context, actor security.Subject, in CostRequest) (*CostItem, error)
CreateCost declares one cost.
func (*InvestorService) EndCost ¶
func (s *InvestorService) EndCost(ctx context.Context, actor security.Subject, costID, lastDay string) (*CostItem, error)
EndCost stops a cost from the day after the one given. The months it ran stay counted; nothing about a closed period changes.
func (*InvestorService) EntriesPage ¶
func (s *InvestorService) EntriesPage(ctx context.Context, actor security.Subject, q EntriesQuery) ([]*Entry, int, error)
EntriesPage is a page of the admin's books and how many rows the whole listing has.
func (*InvestorService) Find ¶
func (s *InvestorService) Find(ctx context.Context, actor security.Subject, id string) (*Investor, error)
Find returns one investor for the admin, and asks the policy twice.
The first call is on the empty candidate, because there is no way to read the record without a Grant and no way to hold a Grant without a decision. What it decides is whether this subject may manage investors at all -- an investor reads their own row through Mine, never by naming an identifier.
The second call is on the record that came back, and it is the one a rule about the record itself depends on.
func (*InvestorService) InvestorContracts ¶
func (s *InvestorService) InvestorContracts(ctx context.Context, actor security.Subject, investorID string) ([]ContractResource, error)
InvestorContracts lists every version of every contract of one investor, newest first, with the products of each. The admin may ask about anybody; an investor only about themselves.
func (*InvestorService) InvoiceReceipt ¶
func (s *InvestorService) InvoiceReceipt(ctx context.Context, actor security.Subject, invoiceID string) (*wallet.WithdrawalRequest, filesystem.File, error)
InvoiceReceipt opens the receipt of an invoice's paid withdrawal, for the investor and the admin. The caller closes the body.
func (*InvestorService) InvoiceViews ¶
func (s *InvestorService) InvoiceViews(ctx context.Context, actor security.Subject, investorID string) ([]InvoiceView, error)
InvoiceViews lists one investor's invoices with the state of each one's withdrawal. An invoice whose request was paid reads as withdrawn.
func (*InvestorService) Invoices ¶
func (s *InvestorService) Invoices(ctx context.Context, actor security.Subject, investorID string) ([]*Invoice, error)
Invoices lists one investor's invoices, newest period first. The admin may ask about anybody; an investor about themselves.
func (*InvestorService) List ¶
func (s *InvestorService) List(ctx context.Context, actor security.Subject, q data.Query) ([]*Investor, error)
List returns a page of investors, for the admin.
It authorizes once, on the empty candidate, and the tenant filter in the statement is what bounds the rows. Listing every investor is an admin's question: the probe for InvestorsManage refuses an investor, who reads their own row through Mine instead.
func (*InvestorService) Mine ¶
Mine returns the investor whose login user is the subject, which is how the investor's own panel finds what to show. ErrNotFound when the subject is not an investor of this tenant.
func (*InvestorService) MonthlyReport ¶
func (s *InvestorService) MonthlyReport(ctx context.Context, actor security.Subject, investorID string, year, month int, w io.Writer) error
MonthlyReport writes, as .xlsx, the invoices of one investor whose period closed in the month, and the entries each one counted with its share of the costs.
func (*InvestorService) PayInvestorWithdrawal ¶
func (s *InvestorService) PayInvestorWithdrawal(ctx context.Context, actor security.Subject, in wallet.PaymentInput, receipt io.Reader) (*wallet.WithdrawalRequest, error)
PayInvestorWithdrawal records that the operator paid an investor's withdrawal, with the receipt.
func (*InvestorService) PayoutAccounts ¶
func (s *InvestorService) PayoutAccounts(ctx context.Context, actor security.Subject, investorID string) ([]*wallet.PayoutAccount, error)
PayoutAccounts are the accounts the investor can be paid into, from arandu-wallet, the usable ones first.
func (*InvestorService) ProjectionOf ¶
func (s *InvestorService) ProjectionOf(ctx context.Context, actor security.Subject, contractID string) (*Projection, error)
ProjectionOf answers the open period of a contract.
func (*InvestorService) RecordEntry ¶
func (s *InvestorService) RecordEntry(ctx context.Context, actor security.Subject, in EntryRequest) (*Entry, error)
RecordEntry records one event, once.
It is idempotent by ExternalRef within the tenant: a second call with the same reference answers the entry the first one recorded, whatever the rest of the body says, because the caller retrying is the case this exists for. The unique index is what decides between two concurrent first calls.
func (*InvestorService) RecordManualEntry ¶
func (s *InvestorService) RecordManualEntry(ctx context.Context, actor security.Subject, in EntryRequest) (*Entry, error)
RecordManualEntry is RecordEntry for the admin's own hand: the same rules, marked as manual in the statement so the investor sees which lines a person typed.
func (*InvestorService) RejectInvestorWithdrawal ¶
func (s *InvestorService) RejectInvestorWithdrawal(ctx context.Context, actor security.Subject, requestID, reason string) (*wallet.WithdrawalRequest, error)
RejectInvestorWithdrawal refuses an investor's withdrawal with the reason they will read. The invoice can be asked for again.
func (*InvestorService) ReverseEntry ¶
func (s *InvestorService) ReverseEntry(ctx context.Context, actor security.Subject, entryID, reason string) (*Entry, error)
ReverseEntry undoes an entry with a new one carrying the opposite amounts, dated now: an entry of a period already closed is corrected in the period that is open, never by reopening the old one. Reversing the same entry twice answers the first reversal.
func (*InvestorService) SetActive ¶
func (s *InvestorService) SetActive(ctx context.Context, actor security.Subject, id string, active bool) (*Investor, error)
SetActive suspends or reactivates an investor. A suspended investor keeps the whole history and is left out of the closings that follow.
func (*InvestorService) StartPaying ¶
func (s *InvestorService) StartPaying(ctx context.Context, actor security.Subject, requestID string) (*wallet.WithdrawalRequest, error)
StartPaying is the operator taking an investor's withdrawal to pay it.
func (*InvestorService) StatementOf ¶
func (s *InvestorService) StatementOf(ctx context.Context, actor security.Subject, contractID string, f StatementFilter) (*Statement, error)
StatementOf answers a contract's statement: each entry of its products with its share of the costs. A line of a closed period carries the cost ratio of the invoice that counted it; a line of the open period carries the projection's, and is marked as an estimate.
func (*InvestorService) Update ¶
func (s *InvestorService) Update(ctx context.Context, actor security.Subject, id string, in UpdateRequest) (*Investor, error)
Update changes the names and the e-mail of an investor.
func (*InvestorService) WithdrawInvoice ¶
func (s *InvestorService) WithdrawInvoice(ctx context.Context, actor security.Subject, invoiceID, accountID string) (*InvoiceView, error)
WithdrawInvoice asks arandu-wallet to pay one invoice, whole, to one of the investor's payout accounts. The investor asks for their own; the admin may ask on an investor's behalf.
func (*InvestorService) Withdrawals ¶
func (s *InvestorService) Withdrawals(ctx context.Context, actor security.Subject, status wallet.WithdrawalStatus) ([]InvestorWithdrawal, error)
Withdrawals is the operator's queue of investors' withdrawals: the requests arandu-wallet holds whose invoice is one of this tenant's.
type InvestorStatus ¶
type InvestorStatus string
InvestorStatus is whether an investor takes part in new closings.
const ( // InvestorActive takes part in every closing of its contracts. InvestorActive InvestorStatus = "active" // InvestorSuspended keeps its history and is left out of new closings. InvestorSuspended InvestorStatus = "suspended" )
type InvestorWithdrawal ¶
type InvestorWithdrawal struct {
Request *wallet.WithdrawalRequest
Invoice *Invoice
Investor *Investor
}
InvestorWithdrawal is one investor's withdrawal request, with the invoice and the investor it pays.
type Invoice ¶
type Invoice struct {
model.Model
ID string `db:"id"`
TenantID string `db:"tenant_id"`
InvestorID string `db:"investor_id"`
// ContractID is the version in force when the period closed; RootID the
// contract every version shares, which is what the periods follow.
ContractID string `db:"contract_id"`
RootID string `db:"root_id"`
// The period is [PeriodStart, PeriodEnd): the end day belongs to the next.
PeriodStart Day `db:"period_start"`
PeriodEnd Day `db:"period_end"`
// The figures, in centavos.
Gross int64 `db:"gross"`
Fees int64 `db:"fees"`
Costs int64 `db:"costs"`
Net int64 `db:"net"`
// CostRatioPPM is the costs as a share of the gross, in parts per million:
// what every line of the statement carries as its part of the costs.
CostRatioPPM int64 `db:"cost_ratio_ppm"`
Amount int64 `db:"amount"`
Status InvoiceStatus `db:"status"`
// WalletOperationID is the deposit that put the amount in the investor's
// wallet. Empty when there was nothing to deposit.
WalletOperationID string `db:"wallet_operation_id"`
// WithdrawalRequestID is the latest arandu-wallet withdrawal request made
// for this invoice, and WithdrawalAttempts how many were made: a rejected
// or cancelled one leaves the invoice to be asked for again.
WithdrawalRequestID string `db:"withdrawal_request_id"`
WithdrawalAttempts int `db:"withdrawal_attempts"`
ClosedBy string `db:"closed_by"`
ClosedAt time.Time `db:"closed_at"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
Invoice is what one closing of one contract produced: the period, the figures it was computed from, and the investor's amount. It is the unit the investor withdraws, and it is never summed into the next period.
type InvoiceCollection ¶
type InvoiceCollection []*Invoice
InvoiceCollection is rows of Invoice, as a query returns them.
func InvoiceCollectionOf ¶
func InvoiceCollectionOf(rows model.Rows) InvoiceCollection
InvoiceCollectionOf converts rows of the table of Invoice. A nil input is a nil collection.
func (InvoiceCollection) Contains ¶
func (c InvoiceCollection) Contains(key any) bool
func (InvoiceCollection) Except ¶
func (c InvoiceCollection) Except(keys ...any) InvoiceCollection
func (InvoiceCollection) Find ¶
func (c InvoiceCollection) Find(key any) *Invoice
func (InvoiceCollection) FindOrFail ¶
func (c InvoiceCollection) FindOrFail(key any) (*Invoice, error)
func (InvoiceCollection) Fresh ¶
func (c InvoiceCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (InvoiceCollection, error)
func (InvoiceCollection) LoadMissing ¶
func (InvoiceCollection) ModelKeys ¶
func (c InvoiceCollection) ModelKeys() []any
func (InvoiceCollection) Only ¶
func (c InvoiceCollection) Only(keys ...any) InvoiceCollection
func (InvoiceCollection) Pluck ¶
func (c InvoiceCollection) Pluck(column string) []any
func (InvoiceCollection) Rows ¶
func (c InvoiceCollection) Rows() model.Rows
Rows converts the collection back to the core's rows.
func (InvoiceCollection) ToArray ¶
func (c InvoiceCollection) ToArray() []map[string]any
func (InvoiceCollection) Unique ¶
func (c InvoiceCollection) Unique() InvoiceCollection
type InvoiceEntry ¶
type InvoiceEntry struct {
model.Model
ID string `db:"id"`
TenantID string `db:"tenant_id"`
InvoiceID string `db:"invoice_id"`
RootID string `db:"root_id"`
EntryID string `db:"entry_id"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
InvoiceEntry records that an entry was counted in an invoice of a contract. It is what lets an entry that arrived late -- dated in a period already closed -- be counted in the next closing instead of reopening the old one, and never twice.
func (*InvoiceEntry) Fresh ¶
func (row *InvoiceEntry) Fresh(ctx context.Context, g auth.Grant, with ...string) (*InvoiceEntry, error)
Fresh reads the row again, as a new InvoiceEntry; it shadows the untyped one the embedded model promotes.
func (*InvoiceEntry) Replicate ¶
func (row *InvoiceEntry) Replicate(except ...string) (*InvoiceEntry, error)
Replicate returns an unsaved copy of the row without its key; it shadows the untyped one the embedded model promotes.
type InvoiceEntryCollection ¶
type InvoiceEntryCollection []*InvoiceEntry
InvoiceEntryCollection is rows of InvoiceEntry, as a query returns them.
func InvoiceEntryCollectionOf ¶
func InvoiceEntryCollectionOf(rows model.Rows) InvoiceEntryCollection
InvoiceEntryCollectionOf converts rows of the table of InvoiceEntry. A nil input is a nil collection.
func (InvoiceEntryCollection) Contains ¶
func (c InvoiceEntryCollection) Contains(key any) bool
func (InvoiceEntryCollection) Except ¶
func (c InvoiceEntryCollection) Except(keys ...any) InvoiceEntryCollection
func (InvoiceEntryCollection) Find ¶
func (c InvoiceEntryCollection) Find(key any) *InvoiceEntry
func (InvoiceEntryCollection) FindOrFail ¶
func (c InvoiceEntryCollection) FindOrFail(key any) (*InvoiceEntry, error)
func (InvoiceEntryCollection) Fresh ¶
func (c InvoiceEntryCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (InvoiceEntryCollection, error)
func (InvoiceEntryCollection) LoadMissing ¶
func (InvoiceEntryCollection) ModelKeys ¶
func (c InvoiceEntryCollection) ModelKeys() []any
func (InvoiceEntryCollection) Only ¶
func (c InvoiceEntryCollection) Only(keys ...any) InvoiceEntryCollection
func (InvoiceEntryCollection) Pluck ¶
func (c InvoiceEntryCollection) Pluck(column string) []any
func (InvoiceEntryCollection) Rows ¶
func (c InvoiceEntryCollection) Rows() model.Rows
Rows converts the collection back to the core's rows.
func (InvoiceEntryCollection) ToArray ¶
func (c InvoiceEntryCollection) ToArray() []map[string]any
func (InvoiceEntryCollection) Unique ¶
func (c InvoiceEntryCollection) Unique() InvoiceEntryCollection
type InvoiceEntryQuery ¶
type InvoiceEntryQuery struct {
// contains filtered or unexported fields
}
InvoiceEntryQuery is a query on the table of InvoiceEntry.
The methods that build return the query, so they chain. The methods that run take a context and an auth.Grant, and return InvoiceEntry rows or a value; there is no way to run one without a Grant.
func InvoiceEntries ¶
func InvoiceEntries(db model.DB) *InvoiceEntryQuery
InvoiceEntries starts a query on the table of InvoiceEntry, through db.
Global scopes are on and, unless the table is Global, every statement is filtered by the tenant of the Grant its terminal takes.
func (*InvoiceEntryQuery) AddSelect ¶
func (q *InvoiceEntryQuery) AddSelect(columns ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) Base ¶
func (q *InvoiceEntryQuery) Base() *model.Builder
Base returns the core builder the query forwards to. It is for code in this package -- a local scope in the custom block of ledger.go -- and for the factory, which builds rows through it.
func (*InvoiceEntryQuery) Clone ¶
func (q *InvoiceEntryQuery) Clone() *InvoiceEntryQuery
Clone returns an independent copy of the query.
func (*InvoiceEntryQuery) Create ¶
func (q *InvoiceEntryQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) Cursor ¶
func (q *InvoiceEntryQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*InvoiceEntry, error]
func (*InvoiceEntryQuery) CursorPaginate ¶
func (q *InvoiceEntryQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, opts pagination.Options, columns ...any) (InvoiceEntryCollection, *pagination.CursorPage, error)
func (*InvoiceEntryQuery) DoesntExist ¶
func (*InvoiceEntryQuery) DoesntHave ¶
func (q *InvoiceEntryQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *InvoiceEntryQuery
func (*InvoiceEntryQuery) Find ¶
func (q *InvoiceEntryQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) FindMany ¶
func (q *InvoiceEntryQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (InvoiceEntryCollection, error)
func (*InvoiceEntryQuery) FindOrFail ¶
func (q *InvoiceEntryQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) FindOrNew ¶
func (q *InvoiceEntryQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) First ¶
func (q *InvoiceEntryQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*InvoiceEntry, error)
First returns the first row, or nil and no error when there is none.
func (*InvoiceEntryQuery) FirstOrCreate ¶
func (q *InvoiceEntryQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) FirstOrFail ¶
func (q *InvoiceEntryQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) FirstOrNew ¶
func (q *InvoiceEntryQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) FirstWhere ¶
func (q *InvoiceEntryQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) ForPage ¶
func (q *InvoiceEntryQuery) ForPage(page, perPage int) *InvoiceEntryQuery
func (*InvoiceEntryQuery) ForceCreate ¶
func (q *InvoiceEntryQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) Get ¶
func (q *InvoiceEntryQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (InvoiceEntryCollection, error)
Get runs the query and returns the rows.
func (*InvoiceEntryQuery) GroupBy ¶
func (q *InvoiceEntryQuery) GroupBy(groups ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) Has ¶
func (q *InvoiceEntryQuery) Has(relation, operator string, count int, boolean string, callback func(*query.Builder)) *InvoiceEntryQuery
func (*InvoiceEntryQuery) InsertOrIgnore ¶
func (*InvoiceEntryQuery) Join ¶
func (q *InvoiceEntryQuery) Join(table any, first any, args ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) Latest ¶
func (q *InvoiceEntryQuery) Latest(column ...string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) Limit ¶
func (q *InvoiceEntryQuery) Limit(value int) *InvoiceEntryQuery
func (*InvoiceEntryQuery) New ¶
func (q *InvoiceEntryQuery) New() (*InvoiceEntry, error)
New returns an empty InvoiceEntry on the query's connection, not yet saved, filled with what WithAttributes recorded on the query.
func (*InvoiceEntryQuery) Offset ¶
func (q *InvoiceEntryQuery) Offset(value int) *InvoiceEntryQuery
func (*InvoiceEntryQuery) Oldest ¶
func (q *InvoiceEntryQuery) Oldest(column ...string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) OrDoesntHave ¶
func (q *InvoiceEntryQuery) OrDoesntHave(relation string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) OrHas ¶
func (q *InvoiceEntryQuery) OrHas(relation, operator string, count int) *InvoiceEntryQuery
func (*InvoiceEntryQuery) OrWhere ¶
func (q *InvoiceEntryQuery) OrWhere(column any, args ...any) *InvoiceEntryQuery
OrWhere adds an or-where clause; a func(*InvoiceEntryQuery) in place of the column adds a group.
func (*InvoiceEntryQuery) OrWhereDoesntHave ¶
func (q *InvoiceEntryQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *InvoiceEntryQuery
func (*InvoiceEntryQuery) OrWhereHas ¶
func (q *InvoiceEntryQuery) OrWhereHas(relation string, callback func(*query.Builder)) *InvoiceEntryQuery
func (*InvoiceEntryQuery) OrWhereNot ¶
func (q *InvoiceEntryQuery) OrWhereNot(column any, args ...any) *InvoiceEntryQuery
OrWhereNot adds an or-joined negated where clause, or a negated group.
func (*InvoiceEntryQuery) OrWhereRelation ¶
func (q *InvoiceEntryQuery) OrWhereRelation(relation string, column any, args ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) OrderBy ¶
func (q *InvoiceEntryQuery) OrderBy(column any, direction ...string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) OrderByDesc ¶
func (q *InvoiceEntryQuery) OrderByDesc(column any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) Paginate ¶
func (q *InvoiceEntryQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (InvoiceEntryCollection, *pagination.LengthAwarePage, error)
func (*InvoiceEntryQuery) Select ¶
func (q *InvoiceEntryQuery) Select(columns ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) SelectRaw ¶
func (q *InvoiceEntryQuery) SelectRaw(expression string, bindings ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) SimplePaginate ¶
func (q *InvoiceEntryQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (InvoiceEntryCollection, *pagination.Page, error)
func (*InvoiceEntryQuery) Sole ¶
func (q *InvoiceEntryQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) UpdateOrCreate ¶
func (q *InvoiceEntryQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*InvoiceEntry, error)
func (*InvoiceEntryQuery) ValueOrFail ¶
func (*InvoiceEntryQuery) Where ¶
func (q *InvoiceEntryQuery) Where(column any, args ...any) *InvoiceEntryQuery
Where adds a where clause; a func(*InvoiceEntryQuery) in place of the column adds a group.
func (*InvoiceEntryQuery) WhereBelongsTo ¶
func (q *InvoiceEntryQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereBetween ¶
func (q *InvoiceEntryQuery) WhereBetween(column any, from, to any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereColumn ¶
func (q *InvoiceEntryQuery) WhereColumn(first any, args ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereDoesntHave ¶
func (q *InvoiceEntryQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereExists ¶
func (q *InvoiceEntryQuery) WhereExists(callback func(*query.Builder)) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereHas ¶
func (q *InvoiceEntryQuery) WhereHas(relation string, callback func(*query.Builder)) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereHasCount ¶
func (q *InvoiceEntryQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereIn ¶
func (q *InvoiceEntryQuery) WhereIn(column any, values []any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereKey ¶
func (q *InvoiceEntryQuery) WhereKey(id any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereNot ¶
func (q *InvoiceEntryQuery) WhereNot(column any, args ...any) *InvoiceEntryQuery
WhereNot adds a negated where clause, or a negated group.
func (*InvoiceEntryQuery) WhereNotExists ¶
func (q *InvoiceEntryQuery) WhereNotExists(callback func(*query.Builder)) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereNotIn ¶
func (q *InvoiceEntryQuery) WhereNotIn(column any, values []any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereNotNull ¶
func (q *InvoiceEntryQuery) WhereNotNull(columns ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereNull ¶
func (q *InvoiceEntryQuery) WhereNull(columns ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WhereRelation ¶
func (q *InvoiceEntryQuery) WhereRelation(relation string, column any, args ...any) *InvoiceEntryQuery
func (*InvoiceEntryQuery) With ¶
func (q *InvoiceEntryQuery) With(relations ...string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WithAvg ¶
func (q *InvoiceEntryQuery) WithAvg(relation, column string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WithCount ¶
func (q *InvoiceEntryQuery) WithCount(relations ...string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WithExists ¶
func (q *InvoiceEntryQuery) WithExists(relation string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WithMax ¶
func (q *InvoiceEntryQuery) WithMax(relation, column string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WithMin ¶
func (q *InvoiceEntryQuery) WithMin(relation, column string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WithSum ¶
func (q *InvoiceEntryQuery) WithSum(relation, column string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) Without ¶
func (q *InvoiceEntryQuery) Without(relations ...string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WithoutGlobalScope ¶
func (q *InvoiceEntryQuery) WithoutGlobalScope(identifier string) *InvoiceEntryQuery
func (*InvoiceEntryQuery) WithoutGlobalScopes ¶
func (q *InvoiceEntryQuery) WithoutGlobalScopes(identifiers ...string) *InvoiceEntryQuery
type InvoiceQuery ¶
type InvoiceQuery struct {
// contains filtered or unexported fields
}
InvoiceQuery is a query on the table of Invoice.
The methods that build return the query, so they chain. The methods that run take a context and an auth.Grant, and return Invoice rows or a value; there is no way to run one without a Grant.
func Invoices ¶
func Invoices(db model.DB) *InvoiceQuery
Invoices starts a query on the table of Invoice, through db.
Global scopes are on and, unless the table is Global, every statement is filtered by the tenant of the Grant its terminal takes.
func (*InvoiceQuery) AddSelect ¶
func (q *InvoiceQuery) AddSelect(columns ...any) *InvoiceQuery
func (*InvoiceQuery) Base ¶
func (q *InvoiceQuery) Base() *model.Builder
Base returns the core builder the query forwards to. It is for code in this package -- a local scope in the custom block of ledger.go -- and for the factory, which builds rows through it.
func (*InvoiceQuery) Clone ¶
func (q *InvoiceQuery) Clone() *InvoiceQuery
Clone returns an independent copy of the query.
func (*InvoiceQuery) CursorPaginate ¶
func (q *InvoiceQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, opts pagination.Options, columns ...any) (InvoiceCollection, *pagination.CursorPage, error)
func (*InvoiceQuery) DoesntExist ¶
func (*InvoiceQuery) DoesntHave ¶
func (q *InvoiceQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *InvoiceQuery
func (*InvoiceQuery) FindMany ¶
func (q *InvoiceQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (InvoiceCollection, error)
func (*InvoiceQuery) FindOrFail ¶
func (*InvoiceQuery) FirstOrCreate ¶
func (*InvoiceQuery) FirstOrFail ¶
func (*InvoiceQuery) FirstOrNew ¶
func (*InvoiceQuery) FirstWhere ¶
func (*InvoiceQuery) ForPage ¶
func (q *InvoiceQuery) ForPage(page, perPage int) *InvoiceQuery
func (*InvoiceQuery) ForceCreate ¶
func (*InvoiceQuery) Get ¶
func (q *InvoiceQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (InvoiceCollection, error)
Get runs the query and returns the rows.
func (*InvoiceQuery) GroupBy ¶
func (q *InvoiceQuery) GroupBy(groups ...any) *InvoiceQuery
func (*InvoiceQuery) Has ¶
func (q *InvoiceQuery) Has(relation, operator string, count int, boolean string, callback func(*query.Builder)) *InvoiceQuery
func (*InvoiceQuery) InsertOrIgnore ¶
func (*InvoiceQuery) Join ¶
func (q *InvoiceQuery) Join(table any, first any, args ...any) *InvoiceQuery
func (*InvoiceQuery) Latest ¶
func (q *InvoiceQuery) Latest(column ...string) *InvoiceQuery
func (*InvoiceQuery) Limit ¶
func (q *InvoiceQuery) Limit(value int) *InvoiceQuery
func (*InvoiceQuery) New ¶
func (q *InvoiceQuery) New() (*Invoice, error)
New returns an empty Invoice on the query's connection, not yet saved, filled with what WithAttributes recorded on the query.
func (*InvoiceQuery) Offset ¶
func (q *InvoiceQuery) Offset(value int) *InvoiceQuery
func (*InvoiceQuery) Oldest ¶
func (q *InvoiceQuery) Oldest(column ...string) *InvoiceQuery
func (*InvoiceQuery) OrDoesntHave ¶
func (q *InvoiceQuery) OrDoesntHave(relation string) *InvoiceQuery
func (*InvoiceQuery) OrHas ¶
func (q *InvoiceQuery) OrHas(relation, operator string, count int) *InvoiceQuery
func (*InvoiceQuery) OrWhere ¶
func (q *InvoiceQuery) OrWhere(column any, args ...any) *InvoiceQuery
OrWhere adds an or-where clause; a func(*InvoiceQuery) in place of the column adds a group.
func (*InvoiceQuery) OrWhereDoesntHave ¶
func (q *InvoiceQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *InvoiceQuery
func (*InvoiceQuery) OrWhereHas ¶
func (q *InvoiceQuery) OrWhereHas(relation string, callback func(*query.Builder)) *InvoiceQuery
func (*InvoiceQuery) OrWhereNot ¶
func (q *InvoiceQuery) OrWhereNot(column any, args ...any) *InvoiceQuery
OrWhereNot adds an or-joined negated where clause, or a negated group.
func (*InvoiceQuery) OrWhereRelation ¶
func (q *InvoiceQuery) OrWhereRelation(relation string, column any, args ...any) *InvoiceQuery
func (*InvoiceQuery) OrderBy ¶
func (q *InvoiceQuery) OrderBy(column any, direction ...string) *InvoiceQuery
func (*InvoiceQuery) OrderByDesc ¶
func (q *InvoiceQuery) OrderByDesc(column any) *InvoiceQuery
func (*InvoiceQuery) Paginate ¶
func (q *InvoiceQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (InvoiceCollection, *pagination.LengthAwarePage, error)
func (*InvoiceQuery) Select ¶
func (q *InvoiceQuery) Select(columns ...any) *InvoiceQuery
func (*InvoiceQuery) SelectRaw ¶
func (q *InvoiceQuery) SelectRaw(expression string, bindings ...any) *InvoiceQuery
func (*InvoiceQuery) SimplePaginate ¶
func (q *InvoiceQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, columns ...any) (InvoiceCollection, *pagination.Page, error)
func (*InvoiceQuery) UpdateOrCreate ¶
func (*InvoiceQuery) ValueOrFail ¶
func (*InvoiceQuery) Where ¶
func (q *InvoiceQuery) Where(column any, args ...any) *InvoiceQuery
Where adds a where clause; a func(*InvoiceQuery) in place of the column adds a group.
func (*InvoiceQuery) WhereBelongsTo ¶
func (q *InvoiceQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *InvoiceQuery
func (*InvoiceQuery) WhereBetween ¶
func (q *InvoiceQuery) WhereBetween(column any, from, to any) *InvoiceQuery
func (*InvoiceQuery) WhereColumn ¶
func (q *InvoiceQuery) WhereColumn(first any, args ...any) *InvoiceQuery
func (*InvoiceQuery) WhereDoesntHave ¶
func (q *InvoiceQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *InvoiceQuery
func (*InvoiceQuery) WhereExists ¶
func (q *InvoiceQuery) WhereExists(callback func(*query.Builder)) *InvoiceQuery
func (*InvoiceQuery) WhereHas ¶
func (q *InvoiceQuery) WhereHas(relation string, callback func(*query.Builder)) *InvoiceQuery
func (*InvoiceQuery) WhereHasCount ¶
func (q *InvoiceQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *InvoiceQuery
func (*InvoiceQuery) WhereIn ¶
func (q *InvoiceQuery) WhereIn(column any, values []any) *InvoiceQuery
func (*InvoiceQuery) WhereKey ¶
func (q *InvoiceQuery) WhereKey(id any) *InvoiceQuery
func (*InvoiceQuery) WhereNot ¶
func (q *InvoiceQuery) WhereNot(column any, args ...any) *InvoiceQuery
WhereNot adds a negated where clause, or a negated group.
func (*InvoiceQuery) WhereNotExists ¶
func (q *InvoiceQuery) WhereNotExists(callback func(*query.Builder)) *InvoiceQuery
func (*InvoiceQuery) WhereNotIn ¶
func (q *InvoiceQuery) WhereNotIn(column any, values []any) *InvoiceQuery
func (*InvoiceQuery) WhereNotNull ¶
func (q *InvoiceQuery) WhereNotNull(columns ...any) *InvoiceQuery
func (*InvoiceQuery) WhereNull ¶
func (q *InvoiceQuery) WhereNull(columns ...any) *InvoiceQuery
func (*InvoiceQuery) WhereRelation ¶
func (q *InvoiceQuery) WhereRelation(relation string, column any, args ...any) *InvoiceQuery
func (*InvoiceQuery) With ¶
func (q *InvoiceQuery) With(relations ...string) *InvoiceQuery
func (*InvoiceQuery) WithAvg ¶
func (q *InvoiceQuery) WithAvg(relation, column string) *InvoiceQuery
func (*InvoiceQuery) WithCount ¶
func (q *InvoiceQuery) WithCount(relations ...string) *InvoiceQuery
func (*InvoiceQuery) WithExists ¶
func (q *InvoiceQuery) WithExists(relation string) *InvoiceQuery
func (*InvoiceQuery) WithMax ¶
func (q *InvoiceQuery) WithMax(relation, column string) *InvoiceQuery
func (*InvoiceQuery) WithMin ¶
func (q *InvoiceQuery) WithMin(relation, column string) *InvoiceQuery
func (*InvoiceQuery) WithSum ¶
func (q *InvoiceQuery) WithSum(relation, column string) *InvoiceQuery
func (*InvoiceQuery) Without ¶
func (q *InvoiceQuery) Without(relations ...string) *InvoiceQuery
func (*InvoiceQuery) WithoutGlobalScope ¶
func (q *InvoiceQuery) WithoutGlobalScope(identifier string) *InvoiceQuery
func (*InvoiceQuery) WithoutGlobalScopes ¶
func (q *InvoiceQuery) WithoutGlobalScopes(identifiers ...string) *InvoiceQuery
type InvoiceStatus ¶
type InvoiceStatus string
InvoiceStatus is where an invoice stands.
const ( // InvoiceAvailable can be withdrawn. InvoiceAvailable InvoiceStatus = "available" // InvoiceOverdue can still be withdrawn; a later period has closed since. InvoiceOverdue InvoiceStatus = "overdue" // InvoiceWithdrawn was withdrawn. InvoiceWithdrawn InvoiceStatus = "withdrawn" // InvoiceNothingDue closed a period whose net was zero or negative: no // amount, no withdrawal, and no loss carried into the next period. InvoiceNothingDue InvoiceStatus = "nothing_due" )
type InvoiceView ¶
type InvoiceView struct {
Invoice Invoice
Withdrawal *wallet.WithdrawalRequest
}
InvoiceView is an invoice with the state of its withdrawal, as arandu-wallet knows it.
func (InvoiceView) Pending ¶
func (v InvoiceView) Pending() bool
Pending reports whether a request for it is waiting for an operator.
func (InvoiceView) Withdrawable ¶
func (v InvoiceView) Withdrawable() bool
Withdrawable reports whether the investor may ask for it now.
func (InvoiceView) Withdrawn ¶
func (v InvoiceView) Withdrawn() bool
Withdrawn reports whether the invoice was paid out.
type Labels ¶
type Labels struct {
Locale string
// contains filtered or unexported fields
}
Labels are the sentences of this package's screens in one locale.
func (Labels) Errors ¶ added in v0.3.0
func (l Labels) Errors(errs validation.Errors) validation.Errors
Errors are the messages of a rejected input in the labels' locale, field by field. The value given is not changed.
func (Labels) Field ¶ added in v0.3.0
Field is what a person reads in place of an input's name, in a summary of the rejected fields: "pix_key" reads "Chave PIX". A field with no line reads the way hesape's page would have drawn it.
func (Labels) Message ¶ added in v0.3.0
Message is one validation message in the labels' locale.
The messages are written in English where they are produced -- by this package from its own English lines, by the framework's validation helpers ("is required") and by arandu-wallet -- because validation.Errors carries sentences and not keys, and an API client reads them as they always were. Here each one is read back against the English lines of the "validation" group, placeholders and all, and drawn again from the same key in the locale asked for. A message no line matches comes back as it was.
func (Labels) Month ¶ added in v0.3.0
Month is the name of a month, 1 to 12, as the reports print it.
func (Labels) Status ¶
func (l Labels) Status(s InvoiceStatus) string
Status is the label of an invoice's status.
func (Labels) Summary ¶ added in v0.3.0
func (l Labels) Summary(errs validation.Errors) []string
Summary is one line per rejected message, the field named before it, for the banner above a form: "Chave PIX: Preencha este campo.". Nil when nothing was rejected, so a layout that ranges over it draws no banner.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is what the application registers.
It implements foundation.Module, which is Name and Routes and nothing else -- that pair is the whole public contract between a package and the framework.
It also implements foundation.Migratable, because it owns a table, and foundation.Publishable, because it hands view sources to the project. The other optional interfaces are declared beside Module in the framework and are opted into the same way, by implementing them: Bootable to prepare state at boot, Background to run a loop of its own, Schedulable to declare work for the scheduler, Health to report on the storage it depends on, Closable to give resources back at shutdown.
func New ¶
New returns the module, or the reason it cannot be built.
The collaborators are parameters and not fields somebody fills in afterwards: a module that could be registered half-wired is a module whose first request is the thing that reports the missing half.
It returns an error rather than panicking or carrying on, because everything it refuses is a wiring mistake, and a wiring mistake found at boot costs one restart. The same mistake found later is a request that reached a nil handle.
func (*Module) AdminRoutes ¶ added in v0.2.0
AdminRoutes registers the admin's routes alone, under AdminPrefix, for an application that mounts them inside its operator console with that console's guards on r.
func (*Module) Boot ¶
Boot refuses to serve when a view this package renders is not in the binary.
A compiled view registers itself from init(), so by the time anything boots the question has one answer already: either the application published the files, compiled them and imported the package they became, or it did not. Asking here turns "did anybody run the install command" into one refusal at start-up that names the views and the command, instead of a 500 on the first request that reached one of them -- which is where it used to be answered, once per page, to whoever happened to open it.
It also holds the destination. Every file the archive offers has to land under the module directory named after this module: an archive that reached resources/views/home.kyse.go would land on a page the application wrote, and what publishes the files writes what the archive says.
func (*Module) InvestorRoutes ¶ added in v0.2.0
InvestorRoutes registers the investor's own routes alone, under Prefix, for an application that mounts them inside its own side -- a customer's panel -- with that side's guards on r.
func (*Module) Labels ¶
Labels answers the sentences in a locale: the one given, else Config.Locale, else FallbackLocale.
func (*Module) Migrations ¶
func (m *Module) Migrations() []foundation.Migration
Migrations declares the schema this module owns.
They are returned in the order their names sort in, which is the order they apply in: the name carries the order, and nothing else decides it.
func (*Module) Name ¶
Name is the module identifier: a lowercase slug, stable, no spaces.
It is what `aru route:list` groups by and what the route names are prefixed with, so changing it changes addresses that other code has already written down.
func (*Module) Publishes ¶
func (m *Module) Publishes() []foundation.Publication
Publishes declares the files this package offers, each at the path it takes relative to the root of the project.
One tree, under one tag. A publication may carry a page, a component, a configuration file, a migration, a catalogue of sentences or an asset, and this package offers the first of those and nothing else. Each absence is a decision rather than an omission:
- configuration is the Config struct New is handed, checked by the compiler and validated before the module exists. A file copied into the project beside it would be a second place to say the same thing, and only one of the two could be the one the code reads.
- a stylesheet, a script or any other asset is registered with the view layer and served from an address derived from its own bytes. Copying one into the project would put a second copy of those bytes under a second address, and a page can only reference one of them.
- translations are overridden by writing the lines the application wants into its own override tree, which the catalogue loader already reads. A copy of every line this package ships is a copy that goes stale, and it goes stale without saying so.
- migrations are declared and collected, never copied. A copy in the project's own migration directory is found by the runner as well, so one schema change applies twice under two names.
What is left is the markup, and it is here for the reason the others are not: it is the one thing the project is expected to edit. A package cannot know what a screen should say in a product it has never seen.
func (*Module) Routes ¶
Routes registers every route of the module: the investor's and the admin's.
They are named, so a URL is built from a name rather than written out a second time somewhere else -- two spellings of one address disagree, and the failure when they do is a link to a 404.
Every route needs somebody signed in, so the guard is mounted once, on the router they are registered on, rather than route by route: r is replaced by the guarded group before the first registration, and no unguarded router is left in scope for the next route to be added to. RequireAuth sends a request with no session to the sign-in screen, and puts the subject of one that has a session on its context, where a handler reads it with ctx.User; Config.Middleware runs after it, and Config.AdminMiddleware after that on the admin's routes.
func (*Module) Service ¶
func (m *Module) Service() *InvestorService
Service is the use cases, for an application that calls them from its own code: the events endpoint it owns, a job, a command. Every method asks the policy, so handing it out opens nothing.
type Paths ¶ added in v0.2.0
type Paths struct {
Me, Contracts, Invoices, Reports, PayoutAccounts string
File, Statement, Projection, Costs string
Withdrawal, Receipt string
Admin, Investors, Suspension, Amendments string
Closings, Due, Entries, Reversal, End string
Withdrawals, Processing, Payment, Rejection string
}
Paths are the segments the routes of this package are built from. Each one starts with "/" and holds no wildcard; Me may be "/", which mounts the investor's own panel at Prefix itself.
GET Prefix + Me the investor's panel
GET Prefix + Me + Contracts their contracts
GET Prefix + Me + Invoices their invoices
GET Prefix + Me + Reports + /{year}[/{month}] their reports
POST Prefix + Me + PayoutAccounts a payout account
GET Prefix + Contracts + /{id} + File|Statement|Projection
GET Prefix + Costs
POST Prefix + Invoices + /{id} + Withdrawal ask for an invoice
GET Prefix + Invoices + /{id} + Receipt the receipt of its payment
and under AdminPrefix: Investors (with Suspension, Contracts, Invoices and Reports below one), Contracts + /{id} + Amendments|Closings, Closings + Due, Entries (with Reversal), Costs (with End), and Withdrawals (with Processing, Payment and Rejection).
type Payer ¶
Payer is who pays the investors, as it is printed on the income report: the company that owns the application. The application passes it in Config.Payer; an empty one prints a dash, never an invented name.
type PersonKind ¶
type PersonKind string
PersonKind is whether an investor is a natural person or a company.
const ( // Person is a natural person, identified by a CPF. Person PersonKind = "person" // Company is a legal entity, identified by a CNPJ. Company PersonKind = "company" )
type ProjectedCost ¶
ProjectedCost is one declared cost and how much of it falls in the open period, before it is shared out.
type ProjectedCostRow ¶
type ProjectedCostRow struct{ Name, Category, Recurrence, Scope, Amount string }
ProjectedCostRow is one declared cost in the open period.
type Projection ¶
type Projection struct {
Contract Contract
PeriodStart Day
PeriodEnd Day
Costs []ProjectedCost
Gross, Fees int64
ProjectedCosts int64
EstimatedNet int64
EstimatedAmount int64
EstimatedCostRatioPPM int64
}
Projection is the open period of a contract: what it is expected to cost, what came in so far, and where that leaves the investor if nothing else happens before it closes.
type ProjectionPageData ¶
type ProjectionPageData struct {
Screen
Contract ContractRow
PeriodStart, PeriodEnd string
Costs []ProjectedCostRow
Gross, Fees, ProjectedCosts, Ratio string
EstimatedNet, EstimatedAmount string
}
ProjectionPageData is one contract's open period.
type Recurrence ¶
type Recurrence string
Recurrence is how often a cost's amount is due.
const ( // Monthly is the amount every billing month. Monthly Recurrence = "monthly" // Yearly is the amount every year, a twelfth of it every billing month. Yearly Recurrence = "yearly" // Once is the amount on StartsOn, and never again. Once Recurrence = "once" )
type ReportLink ¶ added in v0.3.0
type ReportLink struct{ Label, URL string }
ReportLink is one report a screen offers: its label and its address.
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource is the list of fields one Investor is allowed to answer with.
A declared list rather than the entity itself. An encoder handed the entity answers with whatever fields it happens to have, including the ones somebody adds later without ever opening the handler -- and TenantID is exactly such a field: it names another customer's identifier and belongs in no response.
func NewResource ¶
NewResource snapshots one record for the response.
type ScopedCost ¶
ScopedCost is a cost's amount in a window and the products that bear it.
type Screen ¶
type Screen struct {
hview.Page
Labels Labels
// Prefix is where the investor's routes are mounted. URLs has every
// address; Prefix is kept for a published view that still reads it.
Prefix string
// URLs are the addresses of the package's routes.
URLs URLs
// contains filtered or unexported fields
}
Screen is what every page of this package carries: the page hesape's view.New builds, the application's chrome, the sentences, and where the package is mounted.
It embeds hesape's view.Page, so every page of this package is a hesape/view.Layout -- what the layouts of an application on Arandu framework v0.62 and newer assert -- and it answers HasErrors and ErrorSummary as well, so it is also the framework/view.Layout an older layout asks for.
func (Screen) AdminNav ¶
AdminNav is the bar on top of every admin screen: the four lists the admin works in, the current one marked.
func (Screen) All ¶ added in v0.3.0
All is one line per rejected message, for the banner above a form, in the screen's language: the field is named by its label in the catalogue ("Chave PIX: Preencha este campo."), where hesape's page would name it by its input ("Pix key").
func (Screen) BankAccountTypeOptions ¶ added in v0.2.0
func (s Screen) BankAccountTypeOptions() []components.SelectOption
BankAccountTypeOptions are the kinds of bank account.
func (Screen) CellForm ¶
CellForm is a small form posted from a table cell: the CSRF token of the page, the fields given, and one button. Every value is escaped; nothing the caller passes is written as markup.
func (Screen) Chrome ¶ added in v0.2.0
Chrome is what Config.Chrome answered for this screen: the application's sidebar, navigation and account menu, in whatever type its layout draws from. A layout asserts that type on it; nil when Config.Chrome is nil.
func (Screen) ErrorSummary ¶ added in v0.2.0
ErrorSummary is one line per rejected field: framework/view.Layout's name for All.
func (Screen) FieldErrors ¶ added in v0.2.0
FieldErrors is every message for one field.
func (Screen) HasErrors ¶ added in v0.2.0
HasErrors says whether the attempt that landed here was rejected: framework/view.Layout's name for hesape's Any.
func (Screen) KindOptions ¶
func (s Screen) KindOptions() []components.SelectOption
KindOptions are the kinds of entry a filter offers.
func (Screen) LogValue ¶ added in v0.2.0
LogValue is the page as a log line carries it, the token redacted.
func (Screen) ManualKindOptions ¶
func (s Screen) ManualKindOptions() []components.SelectOption
ManualKindOptions are the kinds of entry the admin types by hand: a reversal is made from the entry it undoes, never typed.
func (Screen) MarshalJSON ¶ added in v0.2.0
MarshalJSON writes the page with the CSRF token redacted, as framework/view.Page does: a page dumped for debugging never publishes the token. It answers for every page data that embeds Screen.
func (Screen) PayForm ¶ added in v0.2.0
PayForm is the operator's form, drawn inside a table cell, that marks a withdrawal paid: the end-to-end identifier of the PIX or transfer, and the receipt, a PDF, JPEG or PNG.
func (Screen) PersonOptions ¶
func (s Screen) PersonOptions() []components.SelectOption
PersonOptions are the kinds of person an investor can be.
func (Screen) PixKeyOptions ¶
func (s Screen) PixKeyOptions() []components.SelectOption
PixKeyOptions are the kinds of PIX key.
func (Screen) RecurrenceOptions ¶
func (s Screen) RecurrenceOptions() []components.SelectOption
RecurrenceOptions are how often a cost is due.
func (Screen) SearchLabel ¶ added in v0.3.0
SearchLabel is the name a screen reader gives a table's search box: "Buscar em Extrato".
func (Screen) TableLines ¶
func (s Screen) TableLines() components.DataTableLines
TableLines are the sentences a data table on these screens says.
func (Screen) WithdrawForm ¶ added in v0.2.0
func (s Screen) WithdrawForm(action string, accounts []AccountOption) template.HTML
WithdrawForm is the form, drawn inside a table cell, that asks for one invoice to be paid into one of the accounts given.
func (Screen) WithdrawalStatusOptions ¶
func (s Screen) WithdrawalStatusOptions() []components.SelectOption
WithdrawalStatusOptions are where a withdrawal request can stand.
type Statement ¶
type Statement struct {
Contract Contract
Lines []StatementLine
// Totals of the lines shown.
Gross, Fees, Costs, Net int64
// Open marks the lines whose cost share is an estimate: they belong to the
// period that has not closed yet, whose costs are the projection's.
Open map[string]bool
}
Statement is one contract's entries as the investor reads them.
type StatementFilter ¶
type StatementFilter struct {
From, To Day // [From, To], by the day the entry happened
Kind EntryKind
ProductID string
}
StatementFilter narrows a statement. Every field is optional.
type StatementLine ¶
StatementLine is one entry as the investor's statement shows it: its own gross and fee, its share of the period's costs, and what is left.
func SpreadCosts ¶
func SpreadCosts(entries []Entry, costs int64) []StatementLine
SpreadCosts gives each entry its share of the costs, in proportion to its gross, and makes the shares add up to exactly the total: the centavos the rounding leaves go, one each, to the lines with the largest remainders. Entries with no positive gross carry no cost.
type StatementPageData ¶
type StatementPageData struct {
Screen
Contract ContractRow
Rows []StatementRow
Gross, Fees, Costs, Net string
From, To, Kind, Product string
URL string
HasEstimates bool
}
StatementPageData is one contract's statement.
type StatementRow ¶
type StatementRow struct {
ID, Day, Product, Kind, Description string
Gross, Fee, FeeDetail, Cost, Net string
Estimate bool
GrossSort, FeeSort, CostSort, NetSort, DaySortValue string
}
StatementRow is one line of a statement.
type URLs ¶ added in v0.2.0
type URLs struct {
// contains filtered or unexported fields
}
URLs are the addresses of this package's routes, built from Config.Prefix, Config.AdminPrefix and Config.Paths. The route table is built from the same methods with the wildcard in place of the identifier, so an address a screen links to and the pattern that answers it are one spelling.
func NewURLs ¶ added in v0.2.0
NewURLs builds the addresses for a prefix, an admin prefix and the paths, as New would from a Config holding them. Empty segments take DefaultPaths, and an empty admin prefix is the prefix followed by Paths.Admin.
func (URLs) AdminCosts ¶ added in v0.2.0
AdminCosts are the declared costs, for the admin who declares them.
func (URLs) AdminPrefix ¶ added in v0.2.0
AdminPrefix is where the admin's routes are mounted.
func (URLs) ContractFile ¶ added in v0.2.0
ContractFile downloads a contract's signed copy.
func (URLs) InvestorContracts ¶ added in v0.2.0
InvestorContracts lists (GET) and registers (POST) an investor's contracts.
func (URLs) InvestorInvoices ¶ added in v0.2.0
InvestorInvoices lists an investor's invoices for the admin.
func (URLs) InvestorReports ¶ added in v0.2.0
InvestorReports is the base of an investor's reports for the admin.
func (URLs) MyContracts ¶ added in v0.2.0
MyContracts lists the investor's own contracts.
func (URLs) MyInvoices ¶ added in v0.2.0
MyInvoices lists the investor's own invoices.
func (URLs) MyReports ¶ added in v0.2.0
MyReports is the base of the investor's reports: /{year} and /{year}/{month} below it.
func (URLs) PayoutAccounts ¶ added in v0.2.0
PayoutAccounts is where the investor declares an account to be paid into.
func (URLs) Projection ¶ added in v0.2.0
Projection is a contract's open period.
func (URLs) Receipt ¶ added in v0.2.0
Receipt downloads the receipt of an invoice's paid withdrawal.
func (URLs) Suspension ¶ added in v0.2.0
Suspension suspends (POST) or reactivates (DELETE) an investor.
func (URLs) Withdrawals ¶ added in v0.2.0
Withdrawals is the queue of investors' withdrawals.
type UpdateRequest ¶
UpdateRequest is what may change in an investor after it is registered. The kind and the document are not here: a person does not become a company, and a different document is a different investor.
type WithdrawalRow ¶
type WithdrawalRow struct {
ID, Investor, Amount, Account, Status, StatusKey, RequestedAt, Reason string
Open, Processing, Paid bool
ProcessURL, PayURL, RejectURL, ReceiptURL string
}
WithdrawalRow is one investor's withdrawal request in the operator's queue.
Source Files
¶
- ContractProductQuery.go
- ContractQuery.go
- CostItemProductQuery.go
- CostItemQuery.go
- EntryQuery.go
- InvestorQuery.go
- InvoiceEntryQuery.go
- InvoiceQuery.go
- activity.go
- allocation.go
- closing_service.go
- config.go
- contract.go
- contract_service.go
- ledger.go
- ledger_service.go
- model.go
- module.go
- paths.go
- policy.go
- report_service.go
- resources.go
- screens.go
- screens_service.go
- service.go
- statement_service.go
- translation.go
- views.go
- withdrawal_service.go
- xlsx.go