github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/tests/integration/basic_example_data.go (about) 1 //go:build integration 2 // +build integration 3 4 package integration 5 6 import ( 7 "time" 8 9 "github.com/ydb-platform/ydb-go-sdk/v3/table/types" 10 ) 11 12 func seriesData(id uint64, released time.Time, title, info, comment string) types.Value { 13 var commentValue types.Value 14 if comment == "" { 15 commentValue = types.NullValue(types.TypeText) 16 } else { 17 commentValue = types.TextValue(comment) 18 } 19 return types.StructValue( 20 types.StructFieldValue("series_id", types.Uint64Value(id)), 21 types.StructFieldValue("release_date", types.DateValueFromTime(released)), 22 types.StructFieldValue("title", types.TextValue(title)), 23 types.StructFieldValue("series_info", types.TextValue(info)), 24 types.StructFieldValue("comment", commentValue), 25 ) 26 } 27 28 func seasonData(seriesID, seasonID uint64, title string, first, last time.Time) types.Value { 29 return types.StructValue( 30 types.StructFieldValue("series_id", types.Uint64Value(seriesID)), 31 types.StructFieldValue("season_id", types.Uint64Value(seasonID)), 32 types.StructFieldValue("title", types.TextValue(title)), 33 types.StructFieldValue("first_aired", types.DateValueFromTime(first)), 34 types.StructFieldValue("last_aired", types.DateValueFromTime(last)), 35 ) 36 } 37 38 func episodeData( 39 seriesID, seasonID, episodeID uint64, title string, date time.Time, 40 ) types.Value { 41 return types.StructValue( 42 types.StructFieldValue("series_id", types.Uint64Value(seriesID)), 43 types.StructFieldValue("season_id", types.Uint64Value(seasonID)), 44 types.StructFieldValue("episode_id", types.Uint64Value(episodeID)), 45 types.StructFieldValue("title", types.TextValue(title)), 46 types.StructFieldValue("air_date", types.DateValueFromTime(date)), 47 ) 48 } 49 50 func getSeriesData() types.Value { 51 return types.ListValue( 52 seriesData( 53 1, days("2006-02-03"), "IT Crowd", ""+ 54 "The IT Crowd is a British sitcom produced by Channel 4, written by Graham Linehan, produced by "+ 55 "Ash Atalla and starring Chris O'Dowd, Richard Ayoade, Katherine Parkinson, and Matt Berry.", 56 "", // NULL comment. 57 ), 58 seriesData( 59 2, days("2014-04-06"), "Silicon Valley", ""+ 60 "Silicon Valley is an American comedy television series created by Mike Judge, John Altschuler and "+ 61 "Dave Krinsky. The series focuses on five young men who founded a startup company in Silicon Valley.", 62 "Some comment here", 63 ), 64 ) 65 } 66 67 func getSeasonsData() types.Value { 68 return types.ListValue( 69 seasonData(1, 1, "Season 1", days("2006-02-03"), days("2006-03-03")), 70 seasonData(1, 2, "Season 2", days("2007-08-24"), days("2007-09-28")), 71 seasonData(1, 3, "Season 3", days("2008-11-21"), days("2008-12-26")), 72 seasonData(1, 4, "Season 4", days("2010-06-25"), days("2010-07-30")), 73 seasonData(2, 1, "Season 1", days("2014-04-06"), days("2014-06-01")), 74 seasonData(2, 2, "Season 2", days("2015-04-12"), days("2015-06-14")), 75 seasonData(2, 3, "Season 3", days("2016-04-24"), days("2016-06-26")), 76 seasonData(2, 4, "Season 4", days("2017-04-23"), days("2017-06-25")), 77 seasonData(2, 5, "Season 5", days("2018-03-25"), days("2018-05-13")), 78 ) 79 } 80 81 func getEpisodesData() types.Value { 82 return types.ListValue( 83 episodeData(1, 1, 1, "Yesterday's Jam", days("2006-02-03")), 84 episodeData(1, 1, 2, "Calamity Jen", days("2006-02-03")), 85 episodeData(1, 1, 3, "Fifty-Fifty", days("2006-02-10")), 86 episodeData(1, 1, 4, "The Red Door", days("2006-02-17")), 87 episodeData(1, 1, 5, "The Haunting of Bill Crouse", days("2006-02-24")), 88 episodeData(1, 1, 6, "Aunt Irma Visits", days("2006-03-03")), 89 episodeData(1, 2, 1, "The Work Outing", days("2006-08-24")), 90 episodeData(1, 2, 2, "Return of the Golden Child", days("2007-08-31")), 91 episodeData(1, 2, 3, "Moss and the German", days("2007-09-07")), 92 episodeData(1, 2, 4, "The Dinner Party", days("2007-09-14")), 93 episodeData(1, 2, 5, "Smoke and Mirrors", days("2007-09-21")), 94 episodeData(1, 2, 6, "Men Without Women", days("2007-09-28")), 95 episodeData(1, 3, 1, "From Hell", days("2008-11-21")), 96 episodeData(1, 3, 2, "Are We Not Men?", days("2008-11-28")), 97 episodeData(1, 3, 3, "Tramps Like Us", days("2008-12-05")), 98 episodeData(1, 3, 4, "The Speech", days("2008-12-12")), 99 episodeData(1, 3, 5, "Friendface", days("2008-12-19")), 100 episodeData(1, 3, 6, "Calendar Geeks", days("2008-12-26")), 101 episodeData(1, 4, 1, "Jen The Fredo", days("2010-06-25")), 102 episodeData(1, 4, 2, "The Final Countdown", days("2010-07-02")), 103 episodeData(1, 4, 3, "Something Happened", days("2010-07-09")), 104 episodeData(1, 4, 4, "Italian For Beginners", days("2010-07-16")), 105 episodeData(1, 4, 5, "Bad Boys", days("2010-07-23")), 106 episodeData(1, 4, 6, "Reynholm vs Reynholm", days("2010-07-30")), 107 episodeData(2, 1, 1, "Minimum Viable Product", days("2014-04-06")), 108 episodeData(2, 1, 2, "The Cap Table", days("2014-04-13")), 109 episodeData(2, 1, 3, "Articles of Incorporation", days("2014-04-20")), 110 episodeData(2, 1, 4, "Fiduciary Duties", days("2014-04-27")), 111 episodeData(2, 1, 5, "Signaling Risk", days("2014-05-04")), 112 episodeData(2, 1, 6, "Third Party Insourcing", days("2014-05-11")), 113 episodeData(2, 1, 7, "Proof of Concept", days("2014-05-18")), 114 episodeData(2, 1, 8, "Optimal Tip-to-Tip Efficiency", days("2014-06-01")), 115 episodeData(2, 2, 1, "Sand Hill Shuffle", days("2015-04-12")), 116 episodeData(2, 2, 2, "Runaway Devaluation", days("2015-04-19")), 117 episodeData(2, 2, 3, "Bad Money", days("2015-04-26")), 118 episodeData(2, 2, 4, "The Lady", days("2015-05-03")), 119 episodeData(2, 2, 5, "Server Space", days("2015-05-10")), 120 episodeData(2, 2, 6, "Homicide", days("2015-05-17")), 121 episodeData(2, 2, 7, "Adult Content", days("2015-05-24")), 122 episodeData(2, 2, 8, "White Hat/Black Hat", days("2015-05-31")), 123 episodeData(2, 2, 9, "Binding Arbitration", days("2015-06-07")), 124 episodeData(2, 2, 10, "Two Days of the Condor", days("2015-06-14")), 125 episodeData(2, 3, 1, "Founder Friendly", days("2016-04-24")), 126 episodeData(2, 3, 2, "Two in the Box", days("2016-05-01")), 127 episodeData(2, 3, 3, "Meinertzhagen's Haversack", days("2016-05-08")), 128 episodeData(2, 3, 4, "Maleant Data Systems Solutions", days("2016-05-15")), 129 episodeData(2, 3, 5, "The Empty Chair", days("2016-05-22")), 130 episodeData(2, 3, 6, "Bachmanity Insanity", days("2016-05-29")), 131 episodeData(2, 3, 7, "To Build a Better Beta", days("2016-06-05")), 132 episodeData(2, 3, 8, "Bachman's Earnings Over-Ride", days("2016-06-12")), 133 episodeData(2, 3, 9, "Daily Active Users", days("2016-06-19")), 134 episodeData(2, 3, 10, "The Uptick", days("2016-06-26")), 135 episodeData(2, 4, 1, "Success Failure", days("2017-04-23")), 136 episodeData(2, 4, 2, "Terms of Service", days("2017-04-30")), 137 episodeData(2, 4, 3, "Intellectual Property", days("2017-05-07")), 138 episodeData(2, 4, 4, "Teambuilding Exercise", days("2017-05-14")), 139 episodeData(2, 4, 5, "The Blood Boy", days("2017-05-21")), 140 episodeData(2, 4, 6, "Customer Service", days("2017-05-28")), 141 episodeData(2, 4, 7, "The Patent Troll", days("2017-06-04")), 142 episodeData(2, 4, 8, "The Keenan Vortex", days("2017-06-11")), 143 episodeData(2, 4, 9, "Hooli-Con", days("2017-06-18")), 144 episodeData(2, 4, 10, "Server Error", days("2017-06-25")), 145 episodeData(2, 5, 1, "Grow Fast or Die Slow", days("2018-03-25")), 146 episodeData(2, 5, 2, "Reorientation", days("2018-04-01")), 147 episodeData(2, 5, 3, "Chief Operating Officer", days("2018-04-08")), 148 episodeData(2, 5, 4, "Tech Evangelist", days("2018-04-15")), 149 episodeData(2, 5, 5, "Facial Recognition", days("2018-04-22")), 150 episodeData(2, 5, 6, "Artificial Emotional Intelligence", days("2018-04-29")), 151 episodeData(2, 5, 7, "Initial Coin Offering", days("2018-05-06")), 152 episodeData(2, 5, 8, "Fifty-One Percent", days("2018-05-13")), 153 ) 154 } 155 156 func days(date string) time.Time { 157 const dateISO8601 = "2006-01-02" 158 t, err := time.Parse(dateISO8601, date) 159 if err != nil { 160 panic(err) 161 } 162 return t 163 }