Update real_world example

This commit is contained in:
Anton Medvedev
2024-02-16 23:13:44 +01:00
parent 0d43107999
commit c86f2e2718
4 changed files with 1 additions and 249 deletions
+1
View File
@@ -8,3 +8,4 @@
*.html
custom_tests.json
pro/
test/avs/
-119
View File
@@ -1,119 +0,0 @@
### Variables
| Name | Type |
|------|------|
| AppVersion | `string` |
| CleanMarker | `string` |
| CountryCode | `string` |
| CurrencyCode | `string` |
| DestinationCountry | `string` |
| Features | [UserAgentFeatures](#UserAgentFeatures) |
| GateID | `int` |
| InitializedAt | `int` |
| IsAffiliate | `bool` |
| IsDesktop | `bool` |
| IsMobile | `bool` |
| IsOpenJaw | `bool` |
| KnowEnglish | `bool` |
| Locale | `string` |
| Marker | `string` |
| Market | `string` |
| OriginCountry | `string` |
| Os | `string` |
| OsVersion | `string` |
| Passengers | [Passengers](#Passengers) |
| Random | `float` |
| ReferrerHost | `string` |
| SearchDepth | `int` |
| SearchParamsEnv | [SearchParamsEnv](#SearchParamsEnv) |
| Segments | array([RouteSegment](#RouteSegment)) |
| TravelPayoutsAPI | `bool` |
| TripClass | `string` |
| UserAgentDevice | `string` |
| UserAgentType | `string` |
| UserIP | `string` |
| false | `bool` |
| true | `bool` |
### Functions
| Name | Return type |
|------|-------------|
| all(array(`any`), `func`) | `bool` |
| any(array(`any`), `func`) | `bool` |
| count(array(`any`), `func`) | `int` |
| filter(array(`any`), `func`) | array(`any`) |
| len(array(`any`)) | `int` |
| map(array(`any`), `func`) | array(`any`) |
| none(array(`any`), `func`) | `bool` |
| one(array(`any`), `func`) | `bool` |
### Types
#### DirectFlightsDays
| Field | Type |
|---|---|
| Days | `string` |
| Start | `string` |
#### Passengers
| Field | Type |
|---|---|
| Adults | `int` |
| Children | `int` |
| Infants | `int` |
#### RouteSegment
| Field | Type |
|---|---|
| Date | `string` |
| Destination | `string` |
| DestinationCountry | `string` |
| DestinationName | `string` |
| DirectFlightsDays | [DirectFlightsDays](#DirectFlightsDays) |
| Origin | `string` |
| OriginCountry | `string` |
| OriginName | `string` |
| TranslatedDestination | `string` |
| TranslatedOrigin | `string` |
| UserDestination | `string` |
| UserOrigin | `string` |
#### SearchParamsEnv
| Field | Type |
|---|---|
| AppVersion | `string` |
| CleanMarker | `string` |
| CountryCode | `string` |
| CurrencyCode | `string` |
| DestinationCountry | `string` |
| Features | [UserAgentFeatures](#UserAgentFeatures) |
| GateID | `int` |
| InitializedAt | `int` |
| IsAffiliate | `bool` |
| IsDesktop | `bool` |
| IsMobile | `bool` |
| IsOpenJaw | `bool` |
| KnowEnglish | `bool` |
| Locale | `string` |
| Marker | `string` |
| Market | `string` |
| OriginCountry | `string` |
| Os | `string` |
| OsVersion | `string` |
| Passengers | [Passengers](#Passengers) |
| Random | `float` |
| ReferrerHost | `string` |
| SearchDepth | `int` |
| Segments | array([RouteSegment](#RouteSegment)) |
| TravelPayoutsAPI | `bool` |
| TripClass | `string` |
| UserAgentDevice | `string` |
| UserAgentType | `string` |
| UserIP | `string` |
#### UserAgentFeatures
| Field | Type |
|---|---|
| Assisted | `bool` |
| TopPlacement | `bool` |
| TourTickets | `bool` |
-14
View File
@@ -1,14 +0,0 @@
package main
import (
"fmt"
"github.com/expr-lang/expr/docgen"
"github.com/expr-lang/expr/test/real_world"
)
func main() {
doc := docgen.CreateDoc(real_world.NewEnv())
fmt.Println(doc.Markdown())
}
-116
View File
@@ -1,116 +0,0 @@
package real_world
//go:generate sh -c "go run ./real_docs/generate.go > README.md"
type DirectFlightsDays struct {
Start string
Days string
}
type RouteSegment struct {
Origin string
OriginName string
Destination string
DestinationName string
Date string
OriginCountry string
DestinationCountry string
TranslatedOrigin string
TranslatedDestination string
UserOrigin string
UserDestination string
DirectFlightsDays *DirectFlightsDays
}
type Passengers struct {
Adults uint32
Children uint32
Infants uint32
}
type UserAgentFeatures struct {
Assisted bool
TopPlacement bool
TourTickets bool
}
type SearchParamsEnv struct {
Segments []*RouteSegment
OriginCountry string
DestinationCountry string
SearchDepth int
Passengers *Passengers
TripClass string
UserIP string
KnowEnglish bool
Market string
Marker string
CleanMarker string
Locale string
ReferrerHost string
CountryCode string
CurrencyCode string
IsOpenJaw bool
Os string
OsVersion string
AppVersion string
IsAffiliate bool
InitializedAt int64
Random float32
TravelPayoutsAPI bool
Features *UserAgentFeatures
GateID int32
UserAgentDevice string
UserAgentType string
IsDesktop bool
IsMobile bool
}
type Env struct {
SearchParamsEnv
}
func NewEnv() Env {
return Env{
SearchParamsEnv: SearchParamsEnv{
Segments: []*RouteSegment{
{
Origin: "VOG",
Destination: "SHJ",
},
{
Origin: "SHJ",
Destination: "VOG",
},
},
OriginCountry: "RU",
DestinationCountry: "RU",
SearchDepth: 44,
Passengers: &Passengers{1, 0, 0},
TripClass: "Y",
UserIP: "::1",
KnowEnglish: true,
Market: "ru",
Marker: "123456.direct",
CleanMarker: "123456",
Locale: "ru",
ReferrerHost: "www.aviasales.ru",
CountryCode: "",
CurrencyCode: "usd",
IsOpenJaw: false,
Os: "",
OsVersion: "",
AppVersion: "",
IsAffiliate: true,
InitializedAt: 1570788719,
Random: 0.13497187,
TravelPayoutsAPI: false,
Features: &UserAgentFeatures{},
GateID: 421,
UserAgentDevice: "DESKTOP",
UserAgentType: "WEB",
IsDesktop: true,
IsMobile: false,
},
}
}