Skip to content

Commit

Permalink
lookup - updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
brianvoe committed Dec 12, 2023
1 parent da8d5d9 commit a9640d9
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 43 deletions.
8 changes: 7 additions & 1 deletion company.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,14 @@ func addCompanyLookup() {
Display: "Job",
Category: "company",
Description: "Random job data set",
Example: `{company: "Moen, Pagac and Wuckert", title: "Director", descriptor: "Central", level: "Assurance"}`,
Example: `{
"company": "ClearHealthCosts",
"title": "Agent",
"descriptor": "Future",
"level": "Tactics"
}`,
Output: "map[string]string",
ContentType: "application/json",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (any, error) {
return job(r), nil
},
Expand Down
6 changes: 3 additions & 3 deletions json.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ func addFileJSONLookup() {
Category: "file",
Description: "Generates an object or an array of objects in json format",
Example: `[
{ "id": 1, "first_name": "Markus", "last_name": "Moen" },
{ "id": 2, "first_name": "Alayna", "last_name": "Wuckert" },
{ "id": 3, "first_name": "Lura", "last_name": "Lockman" }
{ "first_name": "Markus", "last_name": "Moen", "password": "Dc0VYXjkWABx" },
{ "first_name": "Osborne", "last_name": "Hilll", "password": "XPJ9OVNbs5lm" },
{ "first_name": "Mertie", "last_name": "Halvorson", "password": "eyl3bhwfV8wA" }
]`,
Output: "[]byte",
ContentType: "application/json",
Expand Down
6 changes: 5 additions & 1 deletion movie.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ func addMovieLookup() {
Display: "Movie",
Category: "movie",
Description: "Random Movie data set",
Example: `{name: "The Matrix", genre: "Action"}`,
Example: `{
"name": "Psycho",
"genre": "Mystery"
}`,
Output: "map[string]string",
ContentType: "application/json",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (any, error) {
return movie(r), nil
},
Expand Down
15 changes: 12 additions & 3 deletions payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ func addPaymentLookup() {
Display: "Currency",
Category: "payment",
Description: "Random currency data set",
Example: `{short: "USD", long: "United States Dollar"}`,
Example: `{
"short": "IQD",
"long": "Iraq Dinar"
}`,
Output: "map[string]string",
ContentType: "application/json",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (any, error) {
Expand Down Expand Up @@ -303,8 +306,14 @@ func addPaymentLookup() {
Display: "Credit Card",
Category: "payment",
Description: "Random credit card data set",
Example: `{type: "Visa", number: "4136459948995369", exp: "01/21", cvv: "513"}`,
Example: `{
"type": "UnionPay",
"number": "4364599489953698",
"exp": "02/24",
"cvv": "300"
}`,
Output: "map[string]any",
ContentType: "application/json",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (any, error) {
return creditCard(r), nil
},
Expand All @@ -326,7 +335,7 @@ func addPaymentLookup() {
Category: "payment",
Description: "Random credit card number",
Example: "4136459948995369",
Output: "int",
Output: "string",
Params: []Param{
{
Field: "types", Display: "Types", Type: "[]string", Default: "all",
Expand Down
76 changes: 46 additions & 30 deletions person.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,37 +211,37 @@ func addPersonLookup() {
Category: "person",
Description: "Random set of person info",
Example: `{
first_name: "Markus",
last_name: "Moen",
gender: "male",
ssn: "420776036",
image: "https://picsum.photos/300/300/people",
hobby: "Swimming",
job: {
company: "Lockman and Sons",
title: "Developer",
descriptor: "Global",
level: "Brand"
},
address: {
address: "5369 Streamville, Rossieview, Hawaii 42591",
street: "5369 Streamville",
city: "Rossieview",
state: "Hawaii",
zip: "42591",
country: "Burkina Faso",
latitude: "-6.662594491850811",
longitude: "23.921575244414612"
"first_name": "Markus",
"last_name": "Moen",
"gender": "male",
"ssn": "275413589",
"image": "https://picsum.photos/208/500",
"hobby": "Lacrosse",
"job": {
"company": "Intermap Technologies",
"title": "Developer",
"descriptor": "Direct",
"level": "Paradigm"
},
contact: {
phone: "6136459948",
email: "carolecarroll@bosco.com"
"address": {
"address": "369 North Cornerbury, Miami, North Dakota 24259",
"street": "369 North Cornerbury",
"city": "Miami",
"state": "North Dakota",
"zip": "24259",
"country": "Ghana",
"latitude": -6.662595,
"longitude": 23.921575
},
credit_card: {
type: "Visa",
number: "6536459948995369",
exp: "03/27",
cvv: "353"
"contact": {
"phone": "3023202027",
"email": "lamarkoelpin@heaney.biz"
},
"credit_card": {
"type": "Maestro",
"number": "39800889982276",
"exp": "01/29",
"cvv": "932"
}
}`,
Output: "map[string]any",
Expand Down Expand Up @@ -387,8 +387,24 @@ func addPersonLookup() {
Display: "Teams",
Category: "person",
Description: "Randomly split people into teams",
Example: `{"Team 1": ["Sharon","Jeff"], "Team 2": ["Billy","Connor"]}`,
Example: `{
"Team 1": [
"Justin",
"Connor",
"Jeff"
],
"Team 2": [
"Sharon",
"Fabian",
"Billy"
],
"Team 3": [
"Steve",
"Robert"
]
}`,
Output: "map[string][]string",
ContentType: "application/json",
Params: []Param{
{Field: "people", Display: "Strings", Type: "[]string", Description: "Array of people"},
{Field: "teams", Display: "Strings", Type: "[]string", Description: "Array of teams"},
Expand Down
15 changes: 10 additions & 5 deletions product.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,24 @@ func addProductLookup() {
AddFuncLookup("product", Info{
Display: "Product Info",
Category: "product",
Description: "Random project info",
Output: "map[string]any",
ContentType: "application/json",
Description: "Random product info",
Example: `{
"name": "olive copper monitor",
"description": "Backwards caused quarterly without week it hungry thing someone him regularly. Whomever this revolt hence from his timing as quantity us these yours.",
"categories": ["clothing", "tools and hardware"],
"categories": [
"clothing",
"tools and hardware"
],
"price": 7.61,
"features": ["ultra-lightweight"],
"features": [
"ultra-lightweight"
],
"color": "navy",
"material": "brass",
"upc": "012780949980"
}`,
Output: "map[string]any",
ContentType: "application/json",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (any, error) {
return product(r), nil
},
Expand Down

0 comments on commit a9640d9

Please sign in to comment.