obtypes

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCredential

func GetCredential[T any](creds Credentials, key string) (T, bool)

func GetCredentialOrDefault

func GetCredentialOrDefault[T any](creds Credentials, key string, defaultValue T) T

func GetHook

func GetHook[T any](acco Accommodation, name string) (*T, bool)

func NewDate

func NewDate(year int, month time.Month, day int) time.Time

Types

type Accommodation

type Accommodation struct {
	AccommodationReference
	Externals  []NameValuePair          `json:"externals,omitempty"`
	Features   []Feature                `json:"features"`
	References []AccommodationReference `json:"references,omitempty"`
	CreatedAt  string                   `json:"createdAt,omitempty"`
	UpdatedAt  string                   `json:"updatedAt,omitempty"`
	ID         string                   `json:"id,omitempty"`
	Visible    bool                     `json:"visible"`
	HookData   map[string]HookEntry     `json:"hookData"`
	Type       string                   `json:"type"`
	Place      string                   `json:"place"`
}

Accommodation models a OpenBooking Accommodation

func (*Accommodation) GetExternal

func (a *Accommodation) GetExternal(key string) interface{}

GetExternal fetches a value with name "key" from Accommodation Externals. If it doesn't exist, returns empty string

func (*Accommodation) HasFeature

func (a *Accommodation) HasFeature(name string) bool

HasFeature returns true if a feature is present otherwise false

type AccommodationReference

type AccommodationReference struct {
	ID                    string             `json:"id,omitempty"`
	ReferenceID           int                `json:"reference_id,omitempty"`
	Type                  string             `json:"type"`
	IsMaster              bool               `json:"is_master,omitempty"`
	ExternalID            string             `json:"external_id"`
	Provider              string             `json:"provider"`
	ProviderName          string             `json:"provider_name,omitempty"`
	Name                  TextMap            `json:"name"`
	NameAdd               TextMap            `json:"name_add"`
	NameCode              TextMap            `json:"name_code"`
	Street                string             `json:"street"`
	Plz                   string             `json:"plz"`
	City                  string             `json:"city"`
	Country               string             `json:"country"`
	Phone                 string             `json:"phone"`
	Email                 string             `json:"email"`
	URL                   string             `json:"url"`
	Description           TextMap            `json:"description"`
	DescriptionArrival    TextMap            `json:"description_arrival"`
	DescriptionConditions TextMap            `json:"description_conditions"`
	BookingUrl            TextMap            `json:"bookingUrl,omitempty"`
	Images                []Image            `json:"images"`
	ImagesServices        []Image            `json:"imagesServices"`
	Ranks                 []Rank             `json:"ranks"`
	Media                 []Media            `json:"media"`
	Position              GeoCoordinates     `json:"position"`
	Quality               *string            `json:"quality"`
	Superior              bool               `json:"superior"`
	Facts                 *TypeFacts         `json:"facts,omitempty"`
	OnDemand              bool               `json:"onDemand"`
	FeaturesUnmapped      [][]string         `json:"raw_features"`
	ResolverExternal      map[string]string  `json:"resolver_external"`
	Externals             []FullExternal     `json:"externals,omitempty"`
	XHookdata             map[string]any     `json:"x_hookdata,omitempty"`
	Rooms                 []Room             `json:"rooms" hash:"-"`
	Tags                  []string           `json:"tags,omitempty"`
	Calendar              *ReferenceCalendar `json:"calendar,omitempty"`
	Source                []byte             `json:"source,omitempty"`
}

AccommodationReference represents an Accommodation object that can be POSTed to the API It contains fewer fields which are not allowed to be POSTed but is the foundation for the full Accommodation type

func (*AccommodationReference) GetName

func (r *AccommodationReference) GetName() string

type ApartmentFacts

type ApartmentFacts struct {
	Beds        int     `json:"beds,omitempty"`
	Bedrooms    int     `json:"bedrooms,omitempty"`
	Sqm         float64 `json:"sqm,omitempty"`
	MaxAdults   int     `json:"maxAdults,omitempty"`
	MinAdults   int     `json:"minAdults,omitempty"`
	MaxChildren int     `json:"maxChildren,omitempty"`
	Type        string  `json:"type,omitempty"`
}

type Booking

type Booking struct {
	ExternalID          string  `json:"external_id"` // Reservation ID
	Group               string  `json:"group"`
	Provider            string  `json:"provider"`
	Checkin             string  `json:"checkin"`
	Checkout            string  `json:"checkout"`
	Booked              string  `json:"booked"`
	Currency            string  `json:"currency"`
	Adults              int     `json:"adults"`
	Children            int     `json:"children"`
	Price               float64 `json:"price"`
	Status              string  `json:"status"`
	Type                string  `json:"type"` // of Reference
	ReferenceName       string  `json:"reference_name"`
	ReferenceExternalID string  `json:"reference_external_id"`
}

Booking type represents a Booking object (read from Providers)

func (*Booking) FormatedPrice

func (b *Booking) FormatedPrice() string

func (*Booking) Shortdate

func (b *Booking) Shortdate(d string) string

Shortdate possible arguments: "in","out","booked" returns the first 10 chars

type BookingMapper

type BookingMapper interface {
	MapBookings(provider *Provider) []Booking
}

type BookingReader

type BookingReader interface {
	ReadBookings(fromDate time.Time, toDate time.Time) (BookingMapper, error)
}

type CampingFacts

type CampingFacts struct {
}

type CitiFact

type CitiFact struct {
	ExternalID string `json:"external_id"`
	MaxAdults  int32  `json:"max_adults"`
}

type CodedText

type CodedText struct {
	Code string `json:"code"`
	Name string `json:"name"`
}

type CodedTextMap

type CodedTextMap struct {
	Code string  `json:"code"`
	Name TextMap `json:"name"`
}

type CodedTextMaps

type CodedTextMaps []CodedTextMap

func (*CodedTextMaps) Scan

func (m *CodedTextMaps) Scan(src interface{}) error

func (CodedTextMaps) Value

func (m CodedTextMaps) Value() (driver.Value, error)

type Contact added in v1.4.1

type Contact struct {
	Phone   string `json:"phone"`
	Email   string `json:"email"`
	Website string `json:"email"`
}

type ContentLanguage

type ContentLanguage string

type Credentials

type Credentials map[string]interface{}

type CurrencyValue

type CurrencyValue struct {
	Currency    string  `json:"currency"`
	Value       string  `json:"value"`
	Converted   bool    `json:"converted"`
	Description TextMap `json:"description"`
}

func (*CurrencyValue) Scan

func (m *CurrencyValue) Scan(src interface{}) error

type CurrencyValues

type CurrencyValues []CurrencyValue

func (*CurrencyValues) Scan

func (m *CurrencyValues) Scan(src interface{}) error

func (CurrencyValues) Value

func (m CurrencyValues) Value() (driver.Value, error)

type DateRange

type DateRange struct {
	FromDate string `json:"from_date"`
	ToDate   string `json:"to_date"`
}

func (DateRange) Includes added in v1.4.2

func (m DateRange) Includes(other DateRange) bool

Includes returns true when `other` is included in the DateRange

func (DateRange) OverlapsWith added in v1.4.2

func (m DateRange) OverlapsWith(other DateRange) bool

OverlapsWith returns true when `other` is overlaps the DateRange

type DateRanges

type DateRanges []DateRange

func (DateRanges) Compress

func (m DateRanges) Compress() (DateRanges, error)

Compress consolidates multiple consecutive date ranges into single Ranges

func (*DateRanges) Scan

func (m *DateRanges) Scan(src interface{}) error

func (DateRanges) Value

func (m DateRanges) Value() (driver.Value, error)

type DesklineAvailability

type DesklineAvailability struct {
	AV        []string `xml:"AV"`
	ProductId string   `xml:"ProductId,attr"`
}

type DesklineOccupancies

type DesklineOccupancies struct {
	XMLName        xml.Name               `xml:"FeratelDsiRS"`
	Availabilities []DesklineAvailability `xml:"Result>AvailabilityCalendar"`
}

<Result Index=\"1\">\n <AvailabilityCalendar ProductId=\"0a380a62-a9c9-481d-898a-1944fe641b8c\">\n <AV>2016-09-30,2,1,999,1,1,1</AV>

type EngineJob

type EngineJob struct {
	JobId       int64       `json:"job_id"`
	Query       *Query      `json:"query"`
	Filter      Filter      `json:"filter"`
	Provider    JobProvider `json:"provider"`
	ExternalIDs []string    `json:"external_ids"`
}

type EngineResponseRecord

type EngineResponseRecord struct {
	Engine    string    `gorethink:"engine"    db:"engine"`
	Group     string    `gorethink:"group"     db:"group"`
	Name      string    `gorethink:"name"      db:"name"`
	Retrieved int       `gorethink:"retrieved" db:"retrieved"`
	Value     float64   `gorethink:"value"     db:"value"`
	OrigTime  float64   `gorethink:"orig_time" db:"orig_time"`
	Time      time.Time `gorethink:"time"      db:"time"`
}

type Feature

type Feature struct {
	ID   interface{} `json:"id"`
	Name string      `json:"name"`
}

type Filter

type Filter struct {
	Type             string            `json:"type"`
	Places           []string          `json:"places"`
	ResolverExternal map[string]string `json:"resolver_external"`
}

type FullExternal

type FullExternal struct {
	NameValuePair
	Source string    `json:"source"`
	TS     time.Time `json:"ts"`
}

type GeoCoordinates

type GeoCoordinates struct {
	Lng float64 `json:"lng"`
	Lat float64 `json:"lat"`
}

GeoCoordinates in Accommodation

func (*GeoCoordinates) Scan

func (p *GeoCoordinates) Scan(src interface{}) error

func (GeoCoordinates) Value

func (p GeoCoordinates) Value() (driver.Value, error)

type GracFacts

type GracFacts struct {
	Catering        []string `json:"catering"`
	Bedrooms        int      `json:"bedrooms,omitempty"`
	Beds            int      `json:"beds"`
	AccessibleBeds  int      `json:"accessiblebeds"`
	Bathrooms       int      `json:"bathrooms"`
	Showers         int      `json:"showers"`
	Toilets         int      `json:"toilets"`
	SittingLounges  int      `json:"sittinglounges"`
	DiningLounges   int      `json:"dininglounges"`
	ConferenceRooms int      `json:"conferenceRooms"`
}

type Group

type Group struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type GroupVisibility

type GroupVisibility struct {
	Group     string
	Visible   bool
	CreatedAt time.Time
}

type HookEntry

type HookEntry struct {
	StatusCode int             `json:"statusCode"`
	Executed   string          `json:"executed"`
	Data       json.RawMessage `json:"data"`
}

type HookTrigger

type HookTrigger struct {
	AccommodationID string
	Source          string
}

type HotelFacts

type HotelFacts struct {
	Beds  int `json:"beds,omitempty"`
	Rooms int `json:"rooms,omitempty"`
}

type IOfferMapper

type IOfferMapper interface {
	Activities() []string
	Accommodation() *OfferAccommodation
	Description() TextMap
	DescriptionHTML() TextMap
	Duration() TextMap
	EventAddress() OfferAddress
	EventDates() DateRanges
	EventLocation() GeoCoordinates
	Images() []OfferImage
	ImportantInfo() TextMap
	ImportantInfoHTML() TextMap
	InfoURL() TextMap
	MaxCapacity() int
	MeetingPoint() TextMap
	MeetingPointHTML() TextMap
	Meta() map[string]string
	PriceAdvertised() string
	PricesFrom() []CurrencyValue
	PromoCode() string
	ProviderName() TextMap
	Segments() []CodedTextMap
	ServicesIncluded() TextMap
	ServicesIncludedHTML() TextMap
	Setting() string
	Source() ([]byte, error)
	SpokenLanguages() []SpokenLanguage
	Tags() []string
	Teaser() TextMap
	TicketInfo() TextMap
	Title() TextMap
	Transport() []string
	Validity() DateRanges
	Weekdays() []string
	WidgetData() any
}

IOfferMapper defines the fields of an Offer that needs to be mappable by an Offer Engine

type Image

type Image struct {
	URL         string  `json:"url" db:"url"`
	Season      string  `json:"season" db:"season"`
	Favourite   bool    `json:"favourite" db:"favourite"`
	Title       TextMap `json:"title" db:"title"`
	Description TextMap `json:"description" db:"description"`
	SortOrder   int     `json:"sortOrder" db:"sortorder"`
}

Image is an Accommodation Image

type Images

type Images []Image

func (*Images) Scan

func (i *Images) Scan(src interface{}) error

func (Images) Value

func (i Images) Value() (driver.Value, error)

type ImportStat

type ImportStat struct {
	Provider    string
	User        string
	Filterfetch int
	Successful  int
	Apierrors   int
	Xmlerrors   []string
	Region      string
	Place       string
	Country     string
}

ImportStat define a statistic object for an import

type ImportTypes

type ImportTypes struct {
	Apartment bool
	Hotel     bool
}

type JSONDate

type JSONDate struct {
	time.Time
}

func NewJSONDate

func NewJSONDate(year int, month time.Month, day int) JSONDate

func NewJSONDateFromTime

func NewJSONDateFromTime(t time.Time) JSONDate

type JobProvider

type JobProvider struct {
	Id               string      `json:"id"`
	Visible          bool        `json:"visible"`
	Preferred        bool        `json:"preferred"`
	Name             string      `json:"name"`
	Engine           string      `json:"engine"`
	Credentials      Credentials `json:"credentials"`
	DeeplinkTemplate *string     `json:"deeplink_template"`
	CreatedAt        *time.Time  `json:"createdAt"`
	UpdatedAt        *time.Time  `json:"updatedAt"`
	Group            string      `json:"group"`
	ResolverUrl      string      `json:"resolver_url"`
	CacheMinutes     int         `json:"cache_minutes"`
	SoftTimeout      int         `json:"max_wait_secs"`
}

type JobRoom

type JobRoom struct {
	Adults      int   `json:"adults" db:"adults"`
	Children    int   `json:"children" db:"children"`
	ChildrenAge []int `json:"childrens_age" db:"childrens_age"`
}

type JobRooms

type JobRooms []JobRoom

func (JobRooms) PersonCount

func (rooms JobRooms) PersonCount() int

type Media

type Media struct {
	Description  string `json:"description"`
	Favourite    bool   `json:"favourite"`
	Type         string `json:"type"`
	URL          string `json:"url"`
	URLParameter string `json:"urlParameter"`
}

Media is used to attach media URLs other than images to the Object Used by Zermatt for Youtube and Google Maps (see Tomas Importer)

type Meta

type Meta map[string]string

func (*Meta) Scan

func (m *Meta) Scan(src interface{}) error

func (Meta) Value

func (m Meta) Value() (driver.Value, error)

type MinimalReference

type MinimalReference struct {
	ID               string            `json:"accommodation"`
	ReferenceID      int               `json:"id"`
	ExternalID       string            `json:"external_id"`
	Provider         string            `json:"provider"`
	Engine           string            `json:"engine"`
	ResolverExternal map[string]string `json:"resolver_external"`
}

type NameValuePair

type NameValuePair struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type OccupyReader

type OccupyReader interface {
	ReadOccupancies(acco *MinimalReference) (*PostableOccupancies, error)
	Whoami() string
	PrepareData() error
}

type Offer

type Offer struct {
	Title           TextMap
	Teaser          TextMap
	Description     TextMap
	DescriptionHTML TextMap
	InfoURL         TextMap
	PricesFrom      []CurrencyValue
	Images          []OfferImage
	SpokenLanguages []SpokenLanguage
	Setting         []CodedTextMap
	Duration        TextMap
	MaxCapacity     int
	Place           string `json:"-"`
	Activities      []string
	Segments        []CodedTextMap
	Tags            []string
	EventAddress    OfferAddress
	EventLocation   GeoCoordinates
	EventDates      []DateRange
	// Where to get a ticket
	TicketInfo TextMap
	// Widget-specific data object
	WidgetData any
	Meta       map[string]string
}

func (*Offer) Scan

func (m *Offer) Scan(src interface{}) error

func (Offer) Value

func (m Offer) Value() (driver.Value, error)

type OfferAccommodation

type OfferAccommodation struct {
	Nights          int     `json:"nights"`
	RoomCategoryID  int     `json:"room_category_id"`
	RoomCategory    TextMap `json:"room_category"`
	AccommodationID string  `json:"accommodation_id"`
}

func (*OfferAccommodation) Scan

func (m *OfferAccommodation) Scan(src interface{}) error

func (OfferAccommodation) Value

func (m OfferAccommodation) Value() (driver.Value, error)

type OfferAddress

type OfferAddress struct {
	ID      string `json:"id"` // Place RKEY here?
	Name    string `json:"name"`
	Street  string `json:"street"`
	City    string `json:"city"`
	ZIP     string `json:"zip"`
	Country string `json:"country"`
}

func (OfferAddress) IsEmpty

func (m OfferAddress) IsEmpty() bool

func (*OfferAddress) Scan

func (m *OfferAddress) Scan(src interface{}) error

func (OfferAddress) Value

func (m OfferAddress) Value() (driver.Value, error)

type OfferFacts

type OfferFacts struct {
	ID               string   `json:"id"`
	Price            float64  `json:"price"`
	Rkey             string   `json:"rkey"`
	AdventureTypes   []string `json:"adventure_types"`
	AdventureSeasons []string `json:"adventure_seasons"`
}

type OfferImage

type OfferImage struct {
	Title     TextMap `json:"title"`
	Copyright string  `json:"copyright"`
	URL       string  `json:"url"`
}

type OfferImages

type OfferImages []OfferImage

func (*OfferImages) Scan

func (m *OfferImages) Scan(src interface{}) error

func (OfferImages) Value

func (m OfferImages) Value() (driver.Value, error)

type OfferPlace

type OfferPlace struct {
	ID   string
	Name TextMap
}

type Place

type Place struct {
	Type           string   `json:"type"`
	Zip            string   `json:"zip"`
	Additionalzips []string `json:"additionalzips"`
}

type PostableOccupancies

type PostableOccupancies struct {
	AccomondationID string
	ReferenceID     int
	Provider        string
	ArrivalDays     []int64
	FreeDays        []int64
	MinStay         []int64
	Rawdata         interface{}
}

type PostableOccupanciesExternal

type PostableOccupanciesExternal struct {
	ProviderID  string
	ExternalID  string
	ArrivalDays []int64
	FreeDays    []int64
	MinStay     []int64
}

type Price

type Price struct {
	Value    float64 `json:"value" db:"value"`
	Taxed    bool    `json:"taxed" db:"taxed"`
	Currency string  `json:"currency" db:"currency"`
}

type Provider

type Provider struct {
	ID          string      `json:"id"`
	Name        string      `json:"name"`
	Engine      string      `json:"engine"`
	Group       string      `json:"group"`
	Importkey   string      `json:"import_key"`
	ImportUrl   string      `json:"import_url"`
	Credentials Credentials `json:"credentials"`
	Visible     bool        `json:"visible"`
}

Provider models a Provider object

func (*Provider) GetImportTypes

func (p *Provider) GetImportTypes() ImportTypes

type Providers

type Providers []Provider

Providers is a slice of Provider type

func (Providers) SelectEngine

func (ps Providers) SelectEngine(engine string) (newP Providers)

SelectEngine returns only the Providers with the given engine ID

type Query

type Query struct {
	Group    string    `json:"group"`
	Checkin  time.Time `json:"checkin"`
	Checkout time.Time `json:"checkout"`
	Rooms    []JobRoom `json:"rooms"`
	Currency string    `json:"currency"`
	Language string    `json:"language"`
}

func (*Query) GetAdults

func (q *Query) GetAdults() int

GetAdults returns the number of adults over all rooms.

func (*Query) GetChildren

func (q *Query) GetChildren() []int

GetChildren returns the number of children over all rooms.

func (*Query) GetChildrenFromAge

func (q *Query) GetChildrenFromAge(age int) int

GetChildrenFromAge returns all children with at least AGE

func (*Query) GetChildrenFromToAge

func (q *Query) GetChildrenFromToAge(minAge, maxAge int) int

GetChildrenFromToAge returns all children between minAge and maxAge inclusive

func (*Query) GetGuests

func (q *Query) GetGuests() int

GetGuests returns the total number of occupants for all rooms incl. children.

func (*Query) GetGuestsFromAge

func (q *Query) GetGuestsFromAge(age int) int

func (*Query) GetTravelDays

func (q *Query) GetTravelDays() int

type Rank

type Rank struct {
	Provider   string                 `json:"provider"`
	ExternalID string                 `json:"external_id"`
	Data       map[string]interface{} `json:"data"`
}

Rank is part of Accommodation and contains a Rating data source

type RawResult

type RawResult struct {
	Rooms               JobRooms `json:"rooms" db:"rooms"`
	RoomExternalId      *string  `json:"room_external_id" db:"room_external_id"`
	ExternalId          string   `json:"external_id" db:"external_id"`
	ReferenceExternalId string   `json:"reference" db:"reference"`
	Price               Price    `json:"price" db:"price"`
	Includes            []string `json:"includes" db:"includes"`
	Title               string   `json:"title" db:"title"`
	Board               string   `json:"board" db:"board"`
	Url                 string   `json:"url" db:"url"`
	Description         string   `json:"description" db:"description"`
	DescriptionRateCode string   `json:"description_rate_code" db:"description_rate_code"`
	RateCode            string   `json:"ratecode" db:"ratecode"`
	Checkin             JSONDate `json:"checkin" db:"checkin"`
	Checkout            JSONDate `json:"checkout" db:"checkout"`
	Language            string   `json:"language" db:"language"`
	Terms               string   `json:"terms" db:"terms"`
}

type ReferenceCalendar

type ReferenceCalendar struct {
	Arrival []int64 `form:"arrival" json:"arrival" xml:"arrival" binding:"required"`
	Free    []int64 `form:"free" json:"free" xml:"free" binding:"required"`
	Minstay []int64 `form:"minstay" json:"minstay" xml:"minstay" binding:"required"`
}

type ReferencePost

type ReferencePost struct {
	Group string
	Data  AccommodationReference
}

type ResultDeliveredRecord

type ResultDeliveredRecord struct {
	ID        string    `gorethink:"id" db:"-"`
	Count     int       `gorethink:"count"     db:"count"`
	Group     string    `gorethink:"group"     db:"group"`
	Reference string    `gorethink:"reference" db:"reference"`
	Type      string    `gorethink:"type" db:"type"`
	OrigTime  float64   `gorethink:"orig_time" db:"orig_time"`
	Time      time.Time `gorethink:"time"      db:"time"`
}

type Room

type Room struct {
	ID             int     `json:"id,omitempty"`
	ExternalID     string  `json:"external_id"`
	Name           TextMap `json:"name"`
	Description    TextMap `json:"description"`
	Currency       string  `json:"currency"`
	ReferenceID    string  `json:"hotel"`
	ImagesServices []Image `json:"image_services"`
}

type Settings

type Settings []string

type SpokenLanguage

type SpokenLanguage struct {
	Code string `json:"code"`
	Name string `json:"name"`
}

func SpokenLanguageFromAny

func SpokenLanguageFromAny(code string) (*SpokenLanguage, bool)

Searches either for 2-letter or 3-letter code

func SpokenLanguageFromISO839_1

func SpokenLanguageFromISO839_1(code string) (*SpokenLanguage, bool)

func SpokenLanguageFromISO839_2

func SpokenLanguageFromISO839_2(code string) (*SpokenLanguage, bool)

func SpokenLanguageFromISO839_3

func SpokenLanguageFromISO839_3(code string) (*SpokenLanguage, bool)

type SpokenLanguages

type SpokenLanguages []SpokenLanguage

func (*SpokenLanguages) Scan

func (m *SpokenLanguages) Scan(src interface{}) error

func (SpokenLanguages) Value

func (m SpokenLanguages) Value() (driver.Value, error)

type TextMap

type TextMap map[string]string

TextMap is a multilanguage string map key=lang, value=text

func NewDefaultTextMap

func NewDefaultTextMap(langs []string, defValue string) (newMap TextMap)

NewDefaultTextMap returns a new TextMap with the defValue set for all langs

func (TextMap) Collect

func (p TextMap) Collect() string

Collect throws the values of every key into a single string useful for searching etc.

func (TextMap) Empty

func (p TextMap) Empty(lang string) bool

Empty returns true if a given language is empty

func (TextMap) Lang

func (p TextMap) Lang(lang string) string

func (TextMap) LangOr

func (p TextMap) LangOr(lang, fallback string) string

func (TextMap) LangOrFirst

func (p TextMap) LangOrFirst(lang string) (string, string, bool)

First returns the first entry with len > 0

func (TextMap) Only

func (p TextMap) Only(lang string, defaultLang string) TextMap

Only returns a copy of the TextMap with the selected language only. If that lang doesn't exist, it falls back to the defaultLang.

func (*TextMap) Scan

func (p *TextMap) Scan(src interface{}) error

func (TextMap) SetDefault

func (p TextMap) SetDefault(str string, langs []string)

func (TextMap) Value

func (p TextMap) Value() (driver.Value, error)

func (TextMap) WithLangs

func (p TextMap) WithLangs(langs []string) TextMap

type TypeFacts

type TypeFacts struct {
	Apartment *ApartmentFacts `json:"apartment,omitempty"`
	Hotel     *HotelFacts     `json:"hotel,omitempty"`
	Offer     *OfferFacts     `json:"offer,omitempty"`
	Camping   *CampingFacts   `json:"camping,omitempty"`
	Crac      *GracFacts      `json:"grac,omitempty"`
}

Jump to

Keyboard shortcuts

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