filter

package
v3.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocumentFilter

type DocumentFilter struct {
	DocumentTypes []string `json:"document_types"`
	CountryCodes  []string `json:"country_codes"`
}

DocumentFilter represents a document filter for checks and tasks

type DocumentFilterBuilder

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

DocumentFilterBuilder builds a DocumentFilter

Example
filter, err := NewDocumentFilterBuilder().
	WithCountryCode("some_country").
	WithDocumentType("some_type").
	Build()

if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

data, err := json.Marshal(filter)
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

fmt.Println(string(data))
Output:

{"document_types":["some_type"],"country_codes":["some_country"]}
Example (CountriesAndDocumentTypes)
filter, err := NewDocumentFilterBuilder().
	WithCountryCodes([]string{"some_country", "some_other_country"}).
	WithDocumentTypes([]string{"some_type", "some_other_type"}).
	Build()

if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

data, err := json.Marshal(filter)
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

fmt.Println(string(data))
Output:

{"document_types":["some_type","some_other_type"],"country_codes":["some_country","some_other_country"]}
Example (MultipleCountriesAndDocumentTypes)
filter, err := NewDocumentFilterBuilder().
	WithCountryCode("some_country").
	WithCountryCode("some_other_country").
	WithDocumentType("some_type").
	WithDocumentType("some_other_type").
	Build()

if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

data, err := json.Marshal(filter)
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

fmt.Println(string(data))
Output:

{"document_types":["some_type","some_other_type"],"country_codes":["some_country","some_other_country"]}

func NewDocumentFilterBuilder

func NewDocumentFilterBuilder() *DocumentFilterBuilder

NewDocumentFilterBuilder creates a new DocumentFilterBuilder

func (*DocumentFilterBuilder) Build

Build creates a new DocumentFilter

func (*DocumentFilterBuilder) WithCountryCode

func (b *DocumentFilterBuilder) WithCountryCode(countryCode string) *DocumentFilterBuilder

WithCountryCode adds a country code to the filter

func (*DocumentFilterBuilder) WithCountryCodes

func (b *DocumentFilterBuilder) WithCountryCodes(countryCodes []string) *DocumentFilterBuilder

WithCountryCodes sets the country codes of the filter

func (*DocumentFilterBuilder) WithDocumentType

func (b *DocumentFilterBuilder) WithDocumentType(documentType string) *DocumentFilterBuilder

WithDocumentType adds a document type to the filter

func (*DocumentFilterBuilder) WithDocumentTypes

func (b *DocumentFilterBuilder) WithDocumentTypes(documentTypes []string) *DocumentFilterBuilder

WithDocumentTypes sets the document types of the filter

Jump to

Keyboard shortcuts

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