schema

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package schema provides schemas and validation functions for it.

Index

Constants

View Source
const (
	// PDVDataSizeLimit is limit to PDVData's size.
	PDVDataSizeLimit = 8 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PDV

type PDV struct {
	Version PDVVersion `json:"version"`

	PDV []PDVObject `json:"pdv"`
}

PDV is main Data object.

func (*PDV) UnmarshalJSON

func (p *PDV) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

func (*PDV) Validate added in v0.2.4

func (p *PDV) Validate() bool

Validate ...

type PDVData

type PDVData interface {
	Validate

	Type() PDVType
}

PDVData is interface for all Data types.

type PDVDataCookie added in v0.2.4

type PDVDataCookie struct {
	Name           string `json:"name"`
	Value          string `json:"value"`
	Domain         string `json:"domain"`
	Path           string `json:"path"`
	SameSite       string `json:"same_site"`
	HostOnly       bool   `json:"host_only"`
	Secure         bool   `json:"secure"`
	ExpirationDate uint64 `json:"expiration_date,omitempty"`
}

PDVDataCookie is PDVData implementation for Cookies(according to https://developer.chrome.com/extensions/cookies).

func (PDVDataCookie) MarshalJSON added in v0.2.4

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

MarshalJSON ...

func (PDVDataCookie) Type added in v0.2.4

func (PDVDataCookie) Type() PDVType

Type ...

func (*PDVDataCookie) Validate added in v0.2.4

func (d *PDVDataCookie) Validate() bool

Validate ...

type PDVDataLoginCookie added in v0.2.4

type PDVDataLoginCookie struct {
	Name           string `json:"name"`
	Value          string `json:"value"`
	Domain         string `json:"domain"`
	Path           string `json:"path"`
	SameSite       string `json:"same_site"`
	HostOnly       bool   `json:"host_only"`
	Secure         bool   `json:"secure"`
	ExpirationDate uint64 `json:"expiration_date,omitempty"`
}

PDVDataLoginCookie is the same as PDVDataCookie but with different type.

func (PDVDataLoginCookie) MarshalJSON added in v0.2.4

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

MarshalJSON ...

func (PDVDataLoginCookie) Type added in v0.2.4

func (PDVDataLoginCookie) Type() PDVType

Type ...

func (*PDVDataLoginCookie) Validate added in v0.2.4

func (d *PDVDataLoginCookie) Validate() bool

Validate ...

type PDVObject

type PDVObject interface {
	Validate

	GetData() []PDVData
}

PDVObject is interface for all versions objects.

type PDVObjectMetaV1

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

PDVObjectMetaV1 is PDVObjectV1 meta Data.

type PDVObjectV1

type PDVObjectV1 struct {
	PDVObjectMetaV1

	Data []PDVData `json:"data"`
}

PDVObjectV1 is PDVObject implementation with v1 version.

func (PDVObjectV1) GetData added in v0.2.4

func (o PDVObjectV1) GetData() []PDVData

GetData returns slice of PDVData.

func (*PDVObjectV1) UnmarshalJSON

func (o *PDVObjectV1) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

func (*PDVObjectV1) Validate

func (o *PDVObjectV1) Validate() bool

Validate ...

type PDVType

type PDVType string

PDVType represents Data type. swagger:enum PDVType

const (
	// PDVCookieType ...
	PDVCookieType PDVType = "cookie"
	// PDVLoginCookieType ...
	PDVLoginCookieType PDVType = "login_cookie"
)

func (*PDVType) UnmarshalText added in v0.2.4

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

UnmarshalText ...

type PDVVersion

type PDVVersion string

PDVVersion represents version. swagger:enum PDVVersion

const (
	// PDVV1 ...
	PDVV1 PDVVersion = "v1"
)

type Validate

type Validate interface {
	Validate() bool
}

Validate ...

Jump to

Keyboard shortcuts

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