Best Ginkgo code snippet using performance.main
project.go
Source:project.go
...141 }142 if screen, err = d.CreateOrUpdateScreen(c, tx, screen); err != nil {143 return144 }145 // è·åçscreenèªå¢idå¤å¶å°maininfoå
146 decodedMainInfo.Screens[k].ScreenID = strconv.FormatInt(screen.ID, 10)147 scIDList[int32(k)] = screen.ID148 scStartTimes[int32(k)] = screen.StartTime149 scEndTimes[int32(k)] = screen.EndTime150 }151 // å建票价152 TkSingleIDList := make(map[int32]int64)153 TkSingleTypeList := make(map[int32]int32)154 var tkPrice model.TicketPrice155 for k, v := range decodedMainInfo.TicketsSingle {156 saleType, _ := strconv.ParseInt(v.Type, 10, 64)157 buyLimit, _ := strconv.ParseInt(v.BuyLimit, 10, 64)158 payMethod, _ := strconv.ParseInt(v.PayMethod, 10, 64)159 ticketID, baseErr := model.GetTicketIDFromBase()160 if ticketID == 0 || baseErr != nil {161 tx.Rollback()162 log.Error("baseCenterè·åticketID失败 ticketid:%s,baseErr:%s", ticketID, baseErr)163 return 0, baseErr164 }165 tkPrice = model.TicketPrice{166 ID: ticketID,167 ProjectID: pid,168 Desc: v.Name,169 Type: 1, // ååºç¥¨170 SaleType: int32(saleType),171 Color: v.Color,172 BuyLimit: int32(buyLimit),173 PaymentMethod: int32(payMethod),174 PaymentValue: v.PayValue,175 DescDetail: v.Desc,176 IsSale: 1, // å¯å®177 IsRefund: -10, // ä¸å¯é178 OriginPrice: -1, // æªè¨ç½®179 MarketPrice: -1,180 SaleStart: TimeNull, // 0000-00-00 00:00:00181 SaleEnd: TimeNull,182 }183 if tkPrice, err = d.CreateOrUpdateTkPrice(c, tx, tkPrice, 0); err != nil {184 return185 }186 //票价éè´187 limitData := d.FormatByPrefix(v.BuyLimitNum, "buy_limit_")188 if err = d.CreateOrUpdateTkPriceExtra(c, tx, limitData, ticketID, pid); err != nil {189 return190 }191 // è·åçticketPriceèªå¢idå¤å¶å°mainInfoå
192 decodedMainInfo.TicketsSingle[k].TicketID = strconv.FormatInt(tkPrice.ID, 10)193 TkSingleIDList[int32(k)] = ticketID194 TkSingleTypeList[int32(k)] = int32(saleType)195 }196 var passScID, allPassScID int64197 // å建é票åºæ¬¡198 passScID, err = d.GetOrUpdatePassSc(c, tx, pid, decodedMainInfo.TicketsPass, scStartTimes, scEndTimes, scTypePass, 0)199 if err != nil {200 return201 }202 decodedMainInfo.TicketsPass, err = d.InsertOrUpdateTkPass(c, tx, pid, passScID, decodedMainInfo.TicketsPass, TkTypePass, scIDList, TkSingleIDList, TkSingleTypeList)203 if err != nil {204 return205 }206 // å建è票åºæ¬¡207 allPassScID, err = d.GetOrUpdatePassSc(c, tx, pid, decodedMainInfo.TicketsAllPass, scStartTimes, scEndTimes, scTypeAllPass, 0)208 if err != nil {209 return210 }211 decodedMainInfo.TicketsAllPass, err = d.InsertOrUpdateTkPass(c, tx, pid, allPassScID, decodedMainInfo.TicketsAllPass, TkTypeAllPass, scIDList, TkSingleIDList, TkSingleTypeList)212 if err != nil {213 return214 }215 // å建æ ç¾216 for _, tagID := range decodedMainInfo.TagIDs {217 err = d.CreateTag(c, tx, pid, tagID)218 if err != nil {219 return220 }221 }222 // å建å宾223 guestImgMap := make(map[int64]string)224 // ç»åå宾对åºå¤´åmap225 if decodedMainInfo.GuestIDs != nil {226 if decodedMainInfo.GuestImgs == nil {227 var guestInfoList []model.Guest228 if err = d.db.Select("id, guest_img").Where("id IN (?)", decodedMainInfo.GuestIDs).Find(&guestInfoList).Error; err != nil {229 log.Error("è·åå宾信æ¯å¤±è´¥:%s", err)230 tx.Rollback()231 return232 }233 for _, v := range guestInfoList {234 guestImgMap[v.ID] = v.GuestImg235 }236 } else {237 for _, v := range decodedMainInfo.GuestImgs {238 guestImgMap[v.ID] = v.ImgURL239 }240 }241 }242 var position int64243 for _, guestID := range decodedMainInfo.GuestIDs {244 if err = tx.Create(&model.ProjectGuest{245 ProjectID: pid,246 GuestID: guestID,247 Position: position,248 GuestImg: guestImgMap[guestID],249 }).Error; err != nil {250 log.Error("项ç®å宾添å 失败:%s", err)251 tx.Rollback()252 return253 }254 position++255 }256 // å°æåºæ¬¡ç¥¨ä»·idçmainInfoæ´æ°å°version_ext257 encodedMainInfo, jsonErr := json.Marshal(decodedMainInfo)258 if jsonErr != nil {259 log.Error("JSONEncode MainInfo失败")260 tx.Rollback()261 return pid, jsonErr262 }263 finalMainInfo := string(encodedMainInfo)264 if len(finalMainInfo) > 4000 {265 log.Error("ä¿¡æ¯éè¿å¤§")266 tx.Rollback()267 return pid, ecode.TicketMainInfoTooLarge268 }269 // ç¼è¾version_ext270 err = tx.Model(&model.VersionExt{}).Where("ver_id = ? and type = ?", verID, 1).Update("main_info", finalMainInfo).Error271 if err != nil {272 tx.Rollback()273 log.Error("æ´æ°versionext失败: %s", err)274 }275 // æ交äºå¡276 tx.Commit()277 return pid, nil278}279// CreateProject çå
¥é¡¹ç®è¡¨280func (d *Dao) CreateProject(c context.Context, tx *gorm.DB, verID uint64, decodedMainInfo ProjectMainInfo) (project model.Item, err error) {281 // å建æ°project282 venueID, _ := strconv.ParseInt(decodedMainInfo.VenueID, 10, 64)283 placeID, _ := strconv.ParseInt(decodedMainInfo.PlaceID, 10, 64)284 compID, _ := strconv.ParseInt(decodedMainInfo.CompID, 10, 64)285 projectType, _ := strconv.ParseInt(decodedMainInfo.Type, 10, 64)286 projectSponsorType, _ := strconv.ParseInt(decodedMainInfo.SponsorType, 10, 64)287 performanceImg, _ := json.Marshal(decodedMainInfo.PerformanceImg)288 projectInfo := model.Item{289 Name: decodedMainInfo.Name,290 StartTime: decodedMainInfo.StartTime,291 EndTime: decodedMainInfo.EndTime,292 VenueID: venueID,293 PlaceID: placeID,294 CompID: compID,295 PerformanceImage: string(performanceImg),296 TicketDesc: decodedMainInfo.SellingProp,297 Type: int32(projectType),298 VerID: verID,299 SponsorType: int32(projectSponsorType),300 Label: decodedMainInfo.Label,301 BuyNumLimit: BuyNumLimit,302 IsSale: 1, // é»è®¤å¼å¯å®303 ExpressFee: -2, //é»è®¤å¼304 }305 if err = tx.Create(&projectInfo).Error; err != nil {306 log.Error("æ°å»ºé¡¹ç®å¤±è´¥:%s", err)307 tx.Rollback()308 return model.Item{}, err309 }310 return projectInfo, nil311}312// CreateProjectExtInfo çå
¥é¡¹ç®è¯¦æ
表313func (d *Dao) CreateProjectExtInfo(c context.Context, tx *gorm.DB, projectID int64, performanceDesc string) (err error) {314 projectExtInfo := model.ItemDetail{315 ProjectID: projectID,316 PerformanceDesc: performanceDesc,317 }318 if err = tx.Create(&projectExtInfo).Error; err != nil {319 log.Error("æ°å»ºé¡¹ç®è¯¦æ
失败:%s", err)320 tx.Rollback()321 return err322 }323 return nil324}325// GetDefaultMainInfo è·ååå§åæ°ç»çmainInfo326func (d *Dao) GetDefaultMainInfo() ProjectMainInfo {327 return ProjectMainInfo{328 Docs: []ImgInfo{},329 Screens: []Screen{},330 TicketsSingle: []TicketSingle{},331 TicketsPass: []TicketPass{},332 TicketsAllPass: []TicketPass{},333 TagIDs: []string{},334 GuestIDs: []int64{},335 GuestImgs: []GuestImg{},336 }337}...
main
Using AI Code Generation
1import "fmt"2func main() {3 fmt.Println("Hello, World!")4}5import "fmt"6func main() {7 fmt.Println("Hello, World!")8}9import "fmt"10func main() {11 fmt.Println("Hello, World!")12}13import "fmt"14func main() {15 fmt.Println("Hello, World!")16}17import "fmt"18func main() {19 fmt.Println("Hello, World!")20}21import "fmt"22func main() {23 fmt.Println("Hello, World!")24}25import "fmt"26func main() {27 fmt.Println("Hello, World!")28}29import "fmt"30func main() {31 fmt.Println("Hello, World!")32}33import "fmt"34func main() {35 fmt.Println("Hello, World!")36}37import "fmt"38func main() {39 fmt.Println("Hello, World!")40}41import "fmt"42func main() {43 fmt.Println("Hello, World!")44}45import "fmt"46func main() {47 fmt.Println("Hello, World!")48}49import "fmt"50func main() {51 fmt.Println("Hello, World!")52}53import "fmt"54func main() {55 fmt.Println("Hello, World!")56}57import "fmt"58func main() {59 fmt.Println("Hello, World!")60}
main
Using AI Code Generation
1import performance2func main() {3 performance.main()4}5import performance6func main() {7 performance.main()8}9import performance10func main() {11 performance.main()12}13import performance14func main() {15 performance.main()16}17import performance18func main() {19 performance.main()20}21import performance22func main() {23 performance.main()24}25import performance26func main() {27 performance.main()28}29import performance30func main() {31 performance.main()32}33import performance34func main() {35 performance.main()36}37import performance38func main() {39 performance.main()40}41import performance42func main() {43 performance.main()44}45import performance46func main() {47 performance.main()48}49import performance50func main() {51 performance.main()52}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!