database

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	// CreateUnidentified creates new "unidentified" calllog record where
	// we don't know the caller.
	CreateUnidentified(ctx context.Context, log structs.CallLog) error
	// RecordCustomerCall records a call that has been associated with a customer.
	// When called, RecordCustomerCall searches for an "unidentified" calllog that
	// was recorded at the same time and replaces that entry.
	RecordCustomerCall(ctx context.Context, record structs.CallLog) error
	// Search searches for all records that match query.
	Search(ctx context.Context, query *SearchQuery) ([]structs.CallLog, error)
}

Database supports storing and retrieving of calllog records.

func New

func New(ctx context.Context, dbName, country string, cli *mongo.Client) (Database, error)

New creates a new client.

type SearchQuery

type SearchQuery struct {
	dbutils.SimpleQueryBuilder
}

SearchQuery searches for calllog records that match the specified query.

func (*SearchQuery) After

func (q *SearchQuery) After(d time.Time) *SearchQuery

After matches all calllog records that happened after d.

func (*SearchQuery) AtDate

func (q *SearchQuery) AtDate(d time.Time) *SearchQuery

AtDate searches for all calllog records that happened at the day d.

func (*SearchQuery) Before

func (q *SearchQuery) Before(d time.Time) *SearchQuery

Before matches all records that happened before d.

func (*SearchQuery) Between

func (q *SearchQuery) Between(start, end time.Time) *SearchQuery

Between matches all records that were created before start - end.

func (*SearchQuery) Caller

func (q *SearchQuery) Caller(number *phonenumbers.PhoneNumber) *SearchQuery

Caller matches all records where match the caller number.

func (*SearchQuery) CallerString

func (q *SearchQuery) CallerString(number string) *SearchQuery

CallerString matches all records where the caller exactly matches number. Use Caller() if you want to match regardless of the number format.

func (*SearchQuery) Customer

func (q *SearchQuery) Customer(source, id string) *SearchQuery

Customer matches all records that are associated with customer.

func (*SearchQuery) InboundNumber

func (q *SearchQuery) InboundNumber(number *phonenumbers.PhoneNumber) *SearchQuery

InboundNumber matches all records where the inbound-number matches number.

func (*SearchQuery) InboundNumberString

func (q *SearchQuery) InboundNumberString(number string) *SearchQuery

InboundNumberString matches all records where the inbound-number exactly matches number. Use InboundNumber() if you want to match regardless of the number format.

func (*SearchQuery) TransferTarget

func (q *SearchQuery) TransferTarget(t string) *SearchQuery

TransferTarget matches the transfer target of the +call.

Jump to

Keyboard shortcuts

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