embedcup

package
v1.40.4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package embedcup contains the common models and embedded structs used across different entities in the Fabriktor. These structs represent shared fields and provide common functionality like Getters and Setters.

Package embedcup contains the common models and embedded structs used across different entities in the Fabriktor. These structs represent shared fields and provide common functionality like Getters and Setters.

Package embedcup contains the common models and embedded structs used across different entities in the Fabriktor. These structs represent shared fields and provide common functionality like Getters and Setters.

Package embedcup contains the common models and embedded structs used across different entities in the Fabriktor. These structs represent shared fields and provide common functionality like Getters and Setters.

Package embedcup contains the common models and embedded structs used across different entities in the Fabriktor. These structs represent shared fields and provide common functionality like Getters and Setters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address added in v1.39.0

type Address struct {

	// The complete formatted address, as returned by Google.
	// example: 1600 Amphitheatre Parkway, Mountain View, CA 94043, USA
	// required: false
	FormattedAddress *string `json:"formatted_address" bson:"formatted_address" validate:"nonnilpointer"`

	// The name of the place, typically for landmarks or specific locations.
	// example: Central Park
	// required: false
	PlaceName *string `json:"place_name" bson:"place_name" validate:"nonnilpointer"`

	// The street number and name of the address.
	// example: 1600 Amphitheatre Parkway
	// required: false
	Street *string `json:"street" bson:"street" validate:"nonnilpointer"`

	// The city or locality of the address.
	// example: Mountain View
	// required: false
	City *string `json:"city" bson:"city" validate:"nonnilpointer"`

	// The state, province, or region of the address.
	// example: CA
	// required: false
	State *string `json:"state" bson:"state" validate:"nonnilpointer"`

	// The postal code of the address.
	// example: 94043
	// required: false
	PostalCode *string `json:"postal_code" bson:"postal_code" validate:"nonnilpointer"`

	// The country of the address.
	// example: USA
	// required: false
	Country *string `json:"country" bson:"country" validate:"nonnilpointer"`

	// The latitude of the location, if available.
	// example: 37.4224764
	// required: false
	Latitude *float64 `json:"latitude" bson:"latitude" validate:"nonnilpointer"`

	// The longitude of the location, if available.
	// example: -122.0842499
	// required: false
	Longitude *float64 `json:"longitude" bson:"longitude" validate:"nonnilpointer"`

	// The Google Place ID associated with the location.
	// example: ChIJ2eUgeAK6j4ARbn5u_wAGqWA
	// required: false
	PlaceID *string `json:"place_id" bson:"place_id" validate:"nonnilpointer"`

	// The timezone of the location implicitely computed from the coordinates.
	// example: America/New_York
	// readOnly: true
	Timezone *string `bson:"timezone" json:"timezone" validate:"nonnilpointer"`
}

Address represents an address picked from a Flutter Google location picker. swagger:model

func NewAddress added in v1.39.8

func NewAddress(
	formattedAddress, placeName, street, city, state, postalCode, country, placeID string,
	latitude, longitude float64,
) *Address

func NewAddressWithTimezone added in v1.40.2

func NewAddressWithTimezone(
	ctx context.Context, c contracts.MapsClientInterface,
	formattedAddress, placeName, street, city, state, postalCode, country, placeID string,
	latitude, longitude float64,
) (*Address, error)

func (*Address) GetCity added in v1.39.0

func (a *Address) GetCity() string

func (*Address) GetCountry added in v1.39.0

func (a *Address) GetCountry() string

func (*Address) GetFormattedAddress added in v1.39.0

func (a *Address) GetFormattedAddress() string

func (*Address) GetLatitude added in v1.39.0

func (a *Address) GetLatitude() float64

func (*Address) GetLongitude added in v1.39.0

func (a *Address) GetLongitude() float64

func (*Address) GetPlaceID added in v1.39.0

func (a *Address) GetPlaceID() string

func (*Address) GetPlaceName added in v1.39.0

func (a *Address) GetPlaceName() string

func (*Address) GetPostalCode added in v1.39.0

func (a *Address) GetPostalCode() string

func (*Address) GetState added in v1.39.0

func (a *Address) GetState() string

func (*Address) GetStreet added in v1.39.0

func (a *Address) GetStreet() string

func (*Address) GetTimezone added in v1.39.0

func (a *Address) GetTimezone() string

func (*Address) SetCity added in v1.39.0

func (a *Address) SetCity(city string)

func (*Address) SetCountry added in v1.39.0

func (a *Address) SetCountry(country string)

func (*Address) SetFormattedAddress added in v1.39.0

func (a *Address) SetFormattedAddress(address string)

func (*Address) SetLatitude added in v1.39.0

func (a *Address) SetLatitude(latitude float64)

func (*Address) SetLongitude added in v1.39.0

func (a *Address) SetLongitude(longitude float64)

func (*Address) SetPlaceID added in v1.39.0

func (a *Address) SetPlaceID(placeID string)

func (*Address) SetPlaceName added in v1.39.0

func (a *Address) SetPlaceName(placeName string)

func (*Address) SetPostalCode added in v1.39.0

func (a *Address) SetPostalCode(postalCode string)

func (*Address) SetState added in v1.39.0

func (a *Address) SetState(state string)

func (*Address) SetStreet added in v1.39.0

func (a *Address) SetStreet(street string)

func (*Address) SetTimezone added in v1.39.0

func (a *Address) SetTimezone(timezone string)

func (*Address) SetTimezoneFromCoordinates added in v1.39.0

func (a *Address) SetTimezoneFromCoordinates(ctx context.Context, c contracts.MapsClientInterface, latitude float64, longitude float64) error

SetTimezoneFromCoordinates sets the timezone from the given coordinates.

type AddressKey added in v1.39.2

type AddressKey = Key

AddressKey represents a key for address-related fields.

const (
	AddressStreetKey           AddressKey = "street"
	AddressCityKey             AddressKey = "city"
	AddressStateKey            AddressKey = "state"
	AddressPostalCodeKey       AddressKey = "postal_code"
	AddressCountryKey          AddressKey = "country"
	AddressLatitudeKey         AddressKey = "latitude"
	AddressLongitudeKey        AddressKey = "longitude"
	AddressPlaceIDKey          AddressKey = "place_id"
	AddressTimezoneKey         AddressKey = "timezone"
	AddressFormattedAddressKey AddressKey = "formatted_address"
	AddressPlaceNameKey        AddressKey = "place_name"
)

type Archive added in v1.35.20

type Archive struct {
	// Indicates whether the document is archived.
	// example: false
	// required: false
	IsArchived *bool `bson:"is_archived" json:"is_archived" validate:"nonnilpointer"`
}

Archive provides a mechanism to flag documents as archived.

This flag enables filtering without preventing access to archived documents.

It serves as an alternative to deletion, helping maintain data integrity and supporting queries for deprecated or legacy documents. swagger:model

func NewArchive added in v1.39.8

func NewArchive(isArchived bool) *Archive

func (*Archive) GetIsArchived added in v1.35.20

func (c *Archive) GetIsArchived() bool

func (*Archive) SetIsArchived added in v1.35.20

func (c *Archive) SetIsArchived(archive bool)

type ArchiveKey added in v1.39.2

type ArchiveKey = Key

ArchiveKey represents a key for archive-related fields.

const (
	ArchiveIsArchivedKey ArchiveKey = "is_archived"
)

type Common

type Common struct {
	// The MongoDB ID of the document.
	// example: 5f6d4b9b9c6f9f0001b9c6f9
	// readOnly: true
	ID *primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`

	// The schema version of the document.
	// example: v1
	// readOnly: true
	SchemaVersion *string `bson:"schema_version" json:"schema_version" conform:"lower" validate:"nonnilpointer,nonzeropointerelem"`

	// The last time the document was updated.
	// example: 2020-10-05T10:00:00Z
	// readOnly: true
	UpdatedAt *time.Time `bson:"updated_at" json:"updated_at" validate:"nonnilpointer,nonzeropointerelem"`

	// The time the document was created.
	// example: 2020-10-05T10:00:00Z
	// readOnly: true
	CreatedAt *time.Time `bson:"created_at" json:"created_at" validate:"nonnilpointer,nonzeropointerelem"`
}

Common represents the common fields for all entities, embedded in all entities. swagger:model

func NewCommon added in v1.39.8

func NewCommon(id primitive.ObjectID, schemaVersion string, updatedAt, createdAt time.Time) *Common

func (*Common) GetCreatedAt

func (c *Common) GetCreatedAt() time.Time

func (*Common) GetID

func (c *Common) GetID() primitive.ObjectID

func (*Common) GetSchemaVersion

func (c *Common) GetSchemaVersion() string

func (*Common) GetUpdatedAt

func (c *Common) GetUpdatedAt() time.Time

func (*Common) SetCreatedAt

func (c *Common) SetCreatedAt(createdAt time.Time)

func (*Common) SetID

func (c *Common) SetID(id primitive.ObjectID)

func (*Common) SetSchemaVersion

func (c *Common) SetSchemaVersion(version string)

func (*Common) SetUpdatedAt

func (c *Common) SetUpdatedAt(updatedAt time.Time)

type CommonKey added in v1.39.2

type CommonKey = Key

CommonKey represents a key for common fields.

const (
	CommonIDKey            CommonKey = "_id"
	CommonSchemaVersionKey CommonKey = "schema_version"
	CommonUpdatedAtKey     CommonKey = "updated_at"
	CommonCreatedAtKey     CommonKey = "created_at"
)

type Date added in v1.40.1

type Date struct {

	// The input date and time in RFC 3339 format, initially set to America/New_York, with the option to override the timezone using the Process method, normalize to midnight, and convert to UTC as per Fabriktor's group README.
	// example: 2021-01-01T00:00:00Z
	// required: true
	Date *time.Time `json:"date" bson:"date" validate:"nonnilpointer,nonzeropointerelem"`

	// ProcessedDate is the date after timezone override, normalization to midnight, and conversion to UTC. If no processing occurs, this field will be equal to date field.
	// example: 2021-01-01T00:00:00Z
	// readOnly: true
	ProcessedDate *time.Time `json:"processed_date" bson:"processed_date" validate:"nonnilpointer,nonzeropointerelem,isutc"`

	// Day extracted from the normalized date.
	// example: 1
	// readOnly: true
	Day *uint `json:"day" bson:"day" validate:"nonnilpointer,nonzeropointerelem"`

	// Month extracted from the normalized date.
	// example: 1
	// readOnly: true
	Month *uint `json:"month" bson:"month" validate:"nonnilpointer,nonzeropointerelem"`

	// Year extracted from the normalized date.
	// example: 2021
	// readOnly: true
	Year *uint `json:"year" bson:"year" validate:"nonnilpointer,nonzeropointerelem"`

	// Hour extracted from the normalized date.
	// example: 0
	// readOnly: true
	Hour *uint `json:"hour" bson:"hour" validate:"nonnilpointer"`
}

Date represents a date optimized for handling multiple time zones, MongoDB pipelines, and query parameter filtering. swagger:model

func NewDate added in v1.40.1

func NewDate(date time.Time) *Date

func NewProcessedDate added in v1.40.2

func NewProcessedDate(date time.Time, timezone string, toUTC bool, toMidnight bool) (*Date, error)

func (*Date) GetDate added in v1.40.1

func (d *Date) GetDate() time.Time

func (*Date) GetDay added in v1.40.1

func (d *Date) GetDay() uint

func (*Date) GetHour added in v1.40.1

func (d *Date) GetHour() uint

func (*Date) GetMonth added in v1.40.1

func (d *Date) GetMonth() uint

func (*Date) GetProcessedDate added in v1.40.1

func (d *Date) GetProcessedDate() time.Time

func (*Date) GetYear added in v1.40.1

func (d *Date) GetYear() uint

func (*Date) Process added in v1.40.1

func (d *Date) Process(timezone string, toUTC bool, toMidnight bool) error

Process converts the date to the specified timezone, normalizes to midnight, and converts to UTC.

func (*Date) SetDate added in v1.40.1

func (d *Date) SetDate(date time.Time)

func (*Date) SetDay added in v1.40.1

func (d *Date) SetDay(day uint)

func (*Date) SetHour added in v1.40.1

func (d *Date) SetHour(hour uint)

func (*Date) SetMonth added in v1.40.1

func (d *Date) SetMonth(month uint)

func (*Date) SetProcessedDate added in v1.40.1

func (d *Date) SetProcessedDate(processedDate time.Time)

func (*Date) SetYear added in v1.40.1

func (d *Date) SetYear(year uint)

type DateKey added in v1.40.1

type DateKey = Key

DateKey represents a key for date-related fields.

const (
	DateDateKey          DateKey = "date"
	DateProcessedDateKey DateKey = "processed_date"
	DateDayKey           DateKey = "day"
	DateMonthKey         DateKey = "month"
	DateYearKey          DateKey = "year"
	DateHourKey          DateKey = "hour"
)

type Key added in v1.39.3

type Key string

Key is an alias for a string.

It is utilized in all embedcup files to represent JSON and BSON keys constants.

func (Key) String added in v1.39.4

func (key Key) String() string

String returns the string representation of the key.

type Owner added in v1.39.2

type Owner struct {
	// The MongoDB ID of the owner of the document.
	// example: 5f7b1b9b9b9b9b9b9b9b9b9b
	// required: true
	OwnerID *primitive.ObjectID `bson:"owner_id" json:"owner_id" validate:"nonnilpointer,nonzeropointerelem"`
}

Owner represents the owner of a document. swagger:model

func NewOwner added in v1.39.8

func NewOwner(ownerID primitive.ObjectID) *Owner

func (*Owner) GetOwnerID added in v1.39.2

func (o *Owner) GetOwnerID() primitive.ObjectID

func (*Owner) SetOwnerID added in v1.39.2

func (o *Owner) SetOwnerID(id primitive.ObjectID)

type OwnerKey added in v1.39.2

type OwnerKey = Key

OwnerKey is an alias for string, representing a key for owner-related fields.

const (
	OwnerIDKey OwnerKey = "owner_id"
)

Jump to

Keyboard shortcuts

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