types

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package types contains shared types and constants for schema package.

Index

Constants

View Source
const (
	// DataSizeLimit is limit to PDVData's size.
	DataSizeLimit = 8 * 1024
)
View Source
const DateFormat = "2006-01-02"

nolint

Variables

This section is empty.

Functions

func IsValidAvatar

func IsValidAvatar(str string) bool

IsValidAvatar checks if avatar url is valid.

func IsValidGender

func IsValidGender(s Gender) bool

IsValidGender checks if s is a valid gender.

func MarshalPDVData

func MarshalPDVData(data Data) ([]byte, error)

MarshalPDVData encodes PDVData (with its type).

Types

type Data

type Data interface {
	Validate

	Type() Type
}

Data is interface for all PDV data types.

type Date

type Date struct {
	time.Time
}

Date in ISO-8601 format (yyyy-mm-dd).

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

type Gender

type Gender string

Gender can be male or female.

const (
	GenderMale   Gender = "male"
	GenderFemale Gender = "female"
)

nolint

type PDV

type PDV interface {
	Validate

	Version() Version
	Data() []Data
}

PDV is interface for all versions objects.

type Source

type Source struct {
	// Domain of website where object was taken
	Host string `json:"host"`
	// Path of website's url where object was taken
	Path string `json:"path"`
}

Source contains information about source of pdv.

func (Source) Validate

func (s Source) Validate() bool

Validate ...

type Timestamp added in v1.2.11

type Timestamp struct {
	Time time.Time `json:"timestamp"`
}

Timestamp in RFC-3339 format.

func (Timestamp) Validate added in v1.2.11

func (t Timestamp) Validate() bool

Validate ...

type Type

type Type string

Type ... swagger:enum Type

const (
	PDVAdvertiserIDType  Type = "advertiserId"
	PDVCookieType        Type = "cookie"
	PDVProfileType       Type = "profile"
	PDVSearchHistoryType Type = "searchHistory"
	PDVLocationType      Type = "location"
)

nolint

func (*Type) UnmarshalText

func (t *Type) UnmarshalText(b []byte) error

UnmarshalText ...

type TypeMapper

type TypeMapper map[Type]reflect.Type

TypeMapper contains rules to decode PDVData.

func (TypeMapper) UnmarshalPDVData

func (m TypeMapper) UnmarshalPDVData(b []byte) (Data, error)

UnmarshalPDVData decodes b into PDVData object.

type Validate

type Validate interface {
	Validate() bool
}

Validate ...

type Version

type Version string

Version ... swagger:enum Version

Jump to

Keyboard shortcuts

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