diff --git a/examples/auto/ac/yesql.go b/examples/auto/ac/yesql.go index 2ebf69f..25e921f 100644 --- a/examples/auto/ac/yesql.go +++ b/examples/auto/ac/yesql.go @@ -1,16 +1,21 @@ // Code generated by Yesql. DO NOT EDIT. // versions: -// - Yesql v1.8.4 +// - Yesql v1.8.5 package ac import ( "context" + "fmt" "github.com/alimy/yesql" "github.com/bitbus/sqlx" ) +var ( + _ = fmt.Errorf("error for placeholder") +) + const ( _ShipIndexA_UserInfo = `SELECT * FROM @user WHERE username=?` _SimpleIndexA_UserInfo = `SELECT * FROM @user WHERE username=?` @@ -154,37 +159,37 @@ func BuildTopicA(p PreparexBuilder, ctx ...context.Context) (obj *TopicA, err er TopicInfos: p.QueryHook(_TopicA_TopicInfos), } if obj.ExistTopicUser, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_ExistTopicUser))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_ExistTopicUser error: %w", err) } if obj.FollowTags, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_FollowTags))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_FollowTags error: %w", err) } if obj.FollowTopic, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_FollowTopic))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_FollowTopic error: %w", err) } if obj.HotTags, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_HotTags))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_HotTags error: %w", err) } if obj.InsertTag, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_InsertTag))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_InsertTag error: %w", err) } if obj.NewestTags, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_NewestTags))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_NewestTags error: %w", err) } if obj.StickTopic, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_StickTopic))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_StickTopic error: %w", err) } if obj.TagsByKeywordA, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_TagsByKeywordA))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_TagsByKeywordA error: %w", err) } if obj.TagsByKeywordB, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_TagsByKeywordB))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_TagsByKeywordB error: %w", err) } if obj.TopicIsTop, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_TopicIsTop))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_TopicIsTop error: %w", err) } if obj.UnfollowTopic, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TopicA_UnfollowTopic))); err != nil { - return + return nil, fmt.Errorf("prepare _TopicA_UnfollowTopic error: %w", err) } return } diff --git a/examples/auto/bc/yesql.go b/examples/auto/bc/yesql.go index db07549..8a46c94 100644 --- a/examples/auto/bc/yesql.go +++ b/examples/auto/bc/yesql.go @@ -1,15 +1,20 @@ // Code generated by Yesql. DO NOT EDIT. // versions: -// - Yesql v1.8.4 +// - Yesql v1.8.5 package bc import ( "context" + "fmt" "github.com/bitbus/sqlx" ) +var ( + _ = fmt.Errorf("error for placeholder") +) + const ( _LoginInfoA = `SELECT * FROM @user WHERE username=?` _LoginInfoB = `SELECT * FROM @user WHERE username=?` @@ -68,19 +73,19 @@ func BuildYesql(p PreparexBuilder, ctx ...context.Context) (obj *Yesql, err erro UserInfoD: p.QueryHook(_UserInfoD), } if obj.LoginInfoB, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_LoginInfoB))); err != nil { - return + return nil, fmt.Errorf("prepare _LoginInfoB error: %w", err) } if obj.UserInfoA, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_UserInfoA))); err != nil { - return + return nil, fmt.Errorf("prepare _UserInfoA error: %w", err) } if obj.UserInfoB, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_UserInfoB))); err != nil { - return + return nil, fmt.Errorf("prepare _UserInfoB error: %w", err) } if obj.LoginInfoA, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_LoginInfoA))); err != nil { - return + return nil, fmt.Errorf("prepare _LoginInfoA error: %w", err) } if obj.LoginInfoE, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_LoginInfoE))); err != nil { - return + return nil, fmt.Errorf("prepare _LoginInfoE error: %w", err) } return } diff --git a/examples/auto/cc/yesql.go b/examples/auto/cc/yesql.go index 38fe0b8..303b959 100644 --- a/examples/auto/cc/yesql.go +++ b/examples/auto/cc/yesql.go @@ -1,16 +1,21 @@ // Code generated by Yesql. DO NOT EDIT. // versions: -// - Yesql v1.8.4 +// - Yesql v1.8.5 package cc import ( "context" + "fmt" "github.com/alimy/yesql" "github.com/bitbus/sqlx" ) +var ( + _ = fmt.Errorf("error for placeholder") +) + const ( _AuthorizationManage_BeFriendIds = `SELECT user_id FROM @contact WHERE friend_id=? AND status=2 AND is_del=0` _AuthorizationManage_IsFriend = `SELECT status FROM @contact WHERE user_id=? AND friend_id=? AND is_del=0` @@ -371,13 +376,13 @@ func BuildAuthorizationManage(p PreparexBuilder, ctx ...context.Context) (obj *A } obj = &AuthorizationManage{} if obj.BeFriendIds, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_AuthorizationManage_BeFriendIds))); err != nil { - return + return nil, fmt.Errorf("prepare _AuthorizationManage_BeFriendIds error: %w", err) } if obj.IsFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_AuthorizationManage_IsFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _AuthorizationManage_IsFriend error: %w", err) } if obj.MyFriendSet, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_AuthorizationManage_MyFriendSet))); err != nil { - return + return nil, fmt.Errorf("prepare _AuthorizationManage_MyFriendSet error: %w", err) } return } @@ -396,16 +401,16 @@ func BuildComment(p PreparexBuilder, ctx ...context.Context) (obj *Comment, err GetUsersByIds: p.QueryHook(_Comment_GetUsersByIds), } if obj.GetCommentById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Comment_GetCommentById))); err != nil { - return + return nil, fmt.Errorf("prepare _Comment_GetCommentById error: %w", err) } if obj.GetCommentReplyById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Comment_GetCommentReplyById))); err != nil { - return + return nil, fmt.Errorf("prepare _Comment_GetCommentReplyById error: %w", err) } if obj.GetCommentThumbs, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Comment_GetCommentThumbs))); err != nil { - return + return nil, fmt.Errorf("prepare _Comment_GetCommentThumbs error: %w", err) } if obj.GetCommentCount, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_Comment_GetCommentCount))); err != nil { - return + return nil, fmt.Errorf("prepare _Comment_GetCommentCount error: %w", err) } return } @@ -419,43 +424,43 @@ func BuildCommentManage(p PreparexBuilder, ctx ...context.Context) (obj *Comment } obj = &CommentManage{} if obj.CreateComment, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_CreateComment))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_CreateComment error: %w", err) } if obj.CreateCommentContent, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_CreateCommentContent))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_CreateCommentContent error: %w", err) } if obj.CreateCommentReply, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_CreateCommentReply))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_CreateCommentReply error: %w", err) } if obj.DeleteComment, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_DeleteComment))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_DeleteComment error: %w", err) } if obj.DeleteCommentReply, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_DeleteCommentReply))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_DeleteCommentReply error: %w", err) } if obj.DeleteCommentThumbs, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_DeleteCommentThumbs))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_DeleteCommentThumbs error: %w", err) } if obj.DeleteReplyThumbs, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_DeleteReplyThumbs))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_DeleteReplyThumbs error: %w", err) } if obj.GetCommentReplyThumb, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_GetCommentReplyThumb))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_GetCommentReplyThumb error: %w", err) } if obj.GetTweetCommentThumb, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_GetTweetCommentThumb))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_GetTweetCommentThumb error: %w", err) } if obj.UpdateCommentThumbsCount, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_UpdateCommentThumbsCount))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_UpdateCommentThumbsCount error: %w", err) } if obj.UpdateReplyThumbsCount, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_CommentManage_UpdateReplyThumbsCount))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_UpdateReplyThumbsCount error: %w", err) } if obj.CreateThumbsUpdownComment, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_CommentManage_CreateThumbsUpdownComment))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_CreateThumbsUpdownComment error: %w", err) } if obj.UpdateThumbsUpdownComment, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_CommentManage_UpdateThumbsUpdownComment))); err != nil { - return + return nil, fmt.Errorf("prepare _CommentManage_UpdateThumbsUpdownComment error: %w", err) } return } @@ -469,40 +474,40 @@ func BuildContactManager(p PreparexBuilder, ctx ...context.Context) (obj *Contac } obj = &ContactManager{} if obj.AddFriendMsgsUpdate, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_AddFriendMsgsUpdate))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_AddFriendMsgsUpdate error: %w", err) } if obj.CreateContact, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_CreateContact))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_CreateContact error: %w", err) } if obj.DelFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_DelFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_DelFriend error: %w", err) } if obj.FreshContactStatus, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_FreshContactStatus))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_FreshContactStatus error: %w", err) } if obj.GetContact, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_GetContact))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_GetContact error: %w", err) } if obj.GetContacts, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_GetContacts))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_GetContacts error: %w", err) } if obj.GetUserFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_GetUserFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_GetUserFriend error: %w", err) } if obj.IsFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_IsFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_IsFriend error: %w", err) } if obj.ListFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_ListFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_ListFriend error: %w", err) } if obj.RejectFriendMsgsUpdate, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_RejectFriendMsgsUpdate))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_RejectFriendMsgsUpdate error: %w", err) } if obj.TotalFriendsById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ContactManager_TotalFriendsById))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_TotalFriendsById error: %w", err) } if obj.CreateMessage, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_ContactManager_CreateMessage))); err != nil { - return + return nil, fmt.Errorf("prepare _ContactManager_CreateMessage error: %w", err) } return } @@ -516,25 +521,25 @@ func BuildFollowingManager(p PreparexBuilder, ctx ...context.Context) (obj *Foll } obj = &FollowingManager{} if obj.CountFollowings, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_CountFollowings))); err != nil { - return + return nil, fmt.Errorf("prepare _FollowingManager_CountFollowings error: %w", err) } if obj.CountFollows, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_CountFollows))); err != nil { - return + return nil, fmt.Errorf("prepare _FollowingManager_CountFollows error: %w", err) } if obj.CreateFollowing, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_CreateFollowing))); err != nil { - return + return nil, fmt.Errorf("prepare _FollowingManager_CreateFollowing error: %w", err) } if obj.DeleteFollowing, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_DeleteFollowing))); err != nil { - return + return nil, fmt.Errorf("prepare _FollowingManager_DeleteFollowing error: %w", err) } if obj.ExistFollowing, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_ExistFollowing))); err != nil { - return + return nil, fmt.Errorf("prepare _FollowingManager_ExistFollowing error: %w", err) } if obj.ListFollowings, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_ListFollowings))); err != nil { - return + return nil, fmt.Errorf("prepare _FollowingManager_ListFollowings error: %w", err) } if obj.ListFollows, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_ListFollows))); err != nil { - return + return nil, fmt.Errorf("prepare _FollowingManager_ListFollows error: %w", err) } return } @@ -548,22 +553,22 @@ func BuildMessage(p PreparexBuilder, ctx ...context.Context) (obj *Message, err } obj = &Message{} if obj.GetMessageById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Message_GetMessageById))); err != nil { - return + return nil, fmt.Errorf("prepare _Message_GetMessageById error: %w", err) } if obj.GetUnreadCount, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Message_GetUnreadCount))); err != nil { - return + return nil, fmt.Errorf("prepare _Message_GetUnreadCount error: %w", err) } if obj.ReadMessage, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Message_ReadMessage))); err != nil { - return + return nil, fmt.Errorf("prepare _Message_ReadMessage error: %w", err) } if obj.CreateMessage, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_Message_CreateMessage))); err != nil { - return + return nil, fmt.Errorf("prepare _Message_CreateMessage error: %w", err) } if obj.GetMessageCount, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_Message_GetMessageCount))); err != nil { - return + return nil, fmt.Errorf("prepare _Message_GetMessageCount error: %w", err) } if obj.GetMessages, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_Message_GetMessages))); err != nil { - return + return nil, fmt.Errorf("prepare _Message_GetMessages error: %w", err) } return } @@ -577,13 +582,13 @@ func BuildSecurity(p PreparexBuilder, ctx ...context.Context) (obj *Security, er } obj = &Security{} if obj.GetLatestPhoneCaptcha, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Security_GetLatestPhoneCaptcha))); err != nil { - return + return nil, fmt.Errorf("prepare _Security_GetLatestPhoneCaptcha error: %w", err) } if obj.UsePhoneCaptcha, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Security_UsePhoneCaptcha))); err != nil { - return + return nil, fmt.Errorf("prepare _Security_UsePhoneCaptcha error: %w", err) } if obj.CreatePhoneCaptcha, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_Security_CreatePhoneCaptcha))); err != nil { - return + return nil, fmt.Errorf("prepare _Security_CreatePhoneCaptcha error: %w", err) } return } @@ -600,16 +605,16 @@ func BuildShipIndex(p PreparexBuilder, ctx ...context.Context) (obj *ShipIndex, IndexCountBySelf: p.QueryHook(_ShipIndex_IndexCountBySelf), } if obj.IndexByAdmin, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ShipIndex_IndexByAdmin))); err != nil { - return + return nil, fmt.Errorf("prepare _ShipIndex_IndexByAdmin error: %w", err) } if obj.IndexByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ShipIndex_IndexByGuest))); err != nil { - return + return nil, fmt.Errorf("prepare _ShipIndex_IndexByGuest error: %w", err) } if obj.IndexCountByAdmin, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ShipIndex_IndexCountByAdmin))); err != nil { - return + return nil, fmt.Errorf("prepare _ShipIndex_IndexCountByAdmin error: %w", err) } if obj.IndexCountByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ShipIndex_IndexCountByGuest))); err != nil { - return + return nil, fmt.Errorf("prepare _ShipIndex_IndexCountByGuest error: %w", err) } return } @@ -623,10 +628,10 @@ func BuildSimpleIndex(p PreparexBuilder, ctx ...context.Context) (obj *SimpleInd } obj = &SimpleIndex{} if obj.Index, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_SimpleIndex_Index))); err != nil { - return + return nil, fmt.Errorf("prepare _SimpleIndex_Index error: %w", err) } if obj.IndexCount, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_SimpleIndex_IndexCount))); err != nil { - return + return nil, fmt.Errorf("prepare _SimpleIndex_IndexCount error: %w", err) } return } @@ -646,91 +651,91 @@ func BuildTweet(p PreparexBuilder, ctx ...context.Context) (obj *Tweet, err erro GetUserPosts: p.QueryHook(_Tweet_GetUserPosts), } if obj.GetPostAttachmentBill, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetPostAttachmentBill))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_GetPostAttachmentBill error: %w", err) } if obj.GetPostById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetPostById))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_GetPostById error: %w", err) } if obj.GetPostContentById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetPostContentById))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_GetPostContentById error: %w", err) } if obj.GetUserPostCollection, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetUserPostCollection))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_GetUserPostCollection error: %w", err) } if obj.GetUserPostCollectionCount, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetUserPostCollectionCount))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_GetUserPostCollectionCount error: %w", err) } if obj.GetUserPostCollections, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetUserPostCollections))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_GetUserPostCollections error: %w", err) } if obj.GetUserPostStar, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetUserPostStar))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_GetUserPostStar error: %w", err) } if obj.GetUserPostStarCount, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetUserPostStarCount))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_GetUserPostStarCount error: %w", err) } if obj.GetUserPostStars, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetUserPostStars))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_GetUserPostStars error: %w", err) } if obj.UserCommentTweetsByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsByFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserCommentTweetsByFriend error: %w", err) } if obj.UserCommentTweetsByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsByGuest))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserCommentTweetsByGuest error: %w", err) } if obj.UserCommentTweetsBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsBySelf))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserCommentTweetsBySelf error: %w", err) } if obj.UserCommentTweetsCountByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsCountByFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserCommentTweetsCountByFriend error: %w", err) } if obj.UserCommentTweetsCountByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsCountByGuest))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserCommentTweetsCountByGuest error: %w", err) } if obj.UserCommentTweetsCountBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsCountBySelf))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserCommentTweetsCountBySelf error: %w", err) } if obj.UserMediaTweetsByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsByFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserMediaTweetsByFriend error: %w", err) } if obj.UserMediaTweetsByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsByGuest))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserMediaTweetsByGuest error: %w", err) } if obj.UserMediaTweetsBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsBySelf))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserMediaTweetsBySelf error: %w", err) } if obj.UserMediaTweetsCountByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsCountByFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserMediaTweetsCountByFriend error: %w", err) } if obj.UserMediaTweetsCountByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsCountByGuest))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserMediaTweetsCountByGuest error: %w", err) } if obj.UserMediaTweetsCountBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsCountBySelf))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserMediaTweetsCountBySelf error: %w", err) } if obj.UserStarTweetsByAdmin, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsByAdmin))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserStarTweetsByAdmin error: %w", err) } if obj.UserStarTweetsByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsByFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserStarTweetsByFriend error: %w", err) } if obj.UserStarTweetsByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsByGuest))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserStarTweetsByGuest error: %w", err) } if obj.UserStarTweetsBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsBySelf))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserStarTweetsBySelf error: %w", err) } if obj.UserStarTweetsCountByAdmin, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsCountByAdmin))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserStarTweetsCountByAdmin error: %w", err) } if obj.UserStarTweetsCountByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsCountByFriend))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserStarTweetsCountByFriend error: %w", err) } if obj.UserStarTweetsCountByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsCountByGuest))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserStarTweetsCountByGuest error: %w", err) } if obj.UserStarTweetsCountBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsCountBySelf))); err != nil { - return + return nil, fmt.Errorf("prepare _Tweet_UserStarTweetsCountBySelf error: %w", err) } return } @@ -756,55 +761,55 @@ func BuildTweetManage(p PreparexBuilder, ctx ...context.Context) (obj *TweetMana DelReplyByCommentIds: p.QueryHook(_TweetManage_DelReplyByCommentIds), } if obj.AddAttachment, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_AddAttachment))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_AddAttachment error: %w", err) } if obj.AddPostCollection, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_AddPostCollection))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_AddPostCollection error: %w", err) } if obj.AddPostStar, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_AddPostStar))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_AddPostStar error: %w", err) } if obj.CommentIdsByPostId, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_CommentIdsByPostId))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_CommentIdsByPostId error: %w", err) } if obj.DelCommentByPostId, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_DelCommentByPostId))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_DelCommentByPostId error: %w", err) } if obj.DelPostById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_DelPostById))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_DelPostById error: %w", err) } if obj.DelPostCollection, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_DelPostCollection))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_DelPostCollection error: %w", err) } if obj.DelPostStar, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_DelPostStar))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_DelPostStar error: %w", err) } if obj.HighlightPost, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_HighlightPost))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_HighlightPost error: %w", err) } if obj.LockPost, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_LockPost))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_LockPost error: %w", err) } if obj.MediaContentByPostId, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_MediaContentByPostId))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_MediaContentByPostId error: %w", err) } if obj.PostHighlightStatus, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_PostHighlightStatus))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_PostHighlightStatus error: %w", err) } if obj.StickPost, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_StickPost))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_StickPost error: %w", err) } if obj.VisiblePost, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_VisiblePost))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_VisiblePost error: %w", err) } if obj.AddPost, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_TweetManage_AddPost))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_AddPost error: %w", err) } if obj.AddPostContent, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_TweetManage_AddPostContent))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_AddPostContent error: %w", err) } if obj.UpdatePost, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_TweetManage_UpdatePost))); err != nil { - return + return nil, fmt.Errorf("prepare _TweetManage_UpdatePost error: %w", err) } return } @@ -820,25 +825,25 @@ func BuildUserManage(p PreparexBuilder, ctx ...context.Context) (obj *UserManage GetUsersByIds: p.QueryHook(_UserManage_GetUsersByIds), } if obj.GetAnyUsers, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_UserManage_GetAnyUsers))); err != nil { - return + return nil, fmt.Errorf("prepare _UserManage_GetAnyUsers error: %w", err) } if obj.GetUserById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_UserManage_GetUserById))); err != nil { - return + return nil, fmt.Errorf("prepare _UserManage_GetUserById error: %w", err) } if obj.GetUserByPhone, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_UserManage_GetUserByPhone))); err != nil { - return + return nil, fmt.Errorf("prepare _UserManage_GetUserByPhone error: %w", err) } if obj.GetUserByUsername, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_UserManage_GetUserByUsername))); err != nil { - return + return nil, fmt.Errorf("prepare _UserManage_GetUserByUsername error: %w", err) } if obj.GetUsersByKeyword, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_UserManage_GetUsersByKeyword))); err != nil { - return + return nil, fmt.Errorf("prepare _UserManage_GetUsersByKeyword error: %w", err) } if obj.CreateUser, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_UserManage_CreateUser))); err != nil { - return + return nil, fmt.Errorf("prepare _UserManage_CreateUser error: %w", err) } if obj.UpdateUser, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_UserManage_UpdateUser))); err != nil { - return + return nil, fmt.Errorf("prepare _UserManage_UpdateUser error: %w", err) } return } @@ -852,40 +857,40 @@ func BuildWallet(p PreparexBuilder, ctx ...context.Context) (obj *Wallet, err er } obj = &Wallet{} if obj.AddUserBalance, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_AddUserBalance))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_AddUserBalance error: %w", err) } if obj.CreateRecharge, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_CreateRecharge))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_CreateRecharge error: %w", err) } if obj.CreateWalletStatement, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_CreateWalletStatement))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_CreateWalletStatement error: %w", err) } if obj.GetRechargeById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_GetRechargeById))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_GetRechargeById error: %w", err) } if obj.GetUserBalance, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_GetUserBalance))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_GetUserBalance error: %w", err) } if obj.GetUserByUid, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_GetUserByUid))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_GetUserByUid error: %w", err) } if obj.GetUserWalletBillCount, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_GetUserWalletBillCount))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_GetUserWalletBillCount error: %w", err) } if obj.GetUserWalletBills, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_GetUserWalletBills))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_GetUserWalletBills error: %w", err) } if obj.MarkSuccessRecharge, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_MarkSuccessRecharge))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_MarkSuccessRecharge error: %w", err) } if obj.MinusUserBalance, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_MinusUserBalance))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_MinusUserBalance error: %w", err) } if obj.NewPostAttachmentBill, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_NewPostAttachmentBill))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_NewPostAttachmentBill error: %w", err) } if obj.NewPostBill, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Wallet_NewPostBill))); err != nil { - return + return nil, fmt.Errorf("prepare _Wallet_NewPostBill error: %w", err) } return } diff --git a/examples/auto/yesql.go b/examples/auto/yesql.go index 91d2f2e..7686943 100644 --- a/examples/auto/yesql.go +++ b/examples/auto/yesql.go @@ -1,16 +1,21 @@ // Code generated by Yesql. DO NOT EDIT. // versions: -// - Yesql v1.8.4 +// - Yesql v1.8.5 package yesql import ( "context" + "fmt" "github.com/alimy/yesql" "github.com/bitbus/sqlx" ) +var ( + _ = fmt.Errorf("error for placeholder") +) + const ( _LoginInfoA = `SELECT * FROM @user WHERE username=?` _LoginInfoB = `SELECT * FROM @user WHERE username=?` @@ -141,19 +146,19 @@ func BuildYesql(p PreparexBuilder, ctx ...context.Context) (obj *Yesql, err erro UserInfoD: p.QueryHook(_UserInfoD), } if obj.LoginInfoB, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_LoginInfoB))); err != nil { - return + return nil, fmt.Errorf("prepare _LoginInfoB error: %w", err) } if obj.UserInfoA, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_UserInfoA))); err != nil { - return + return nil, fmt.Errorf("prepare _UserInfoA error: %w", err) } if obj.UserInfoB, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_UserInfoB))); err != nil { - return + return nil, fmt.Errorf("prepare _UserInfoB error: %w", err) } if obj.LoginInfoA, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_LoginInfoA))); err != nil { - return + return nil, fmt.Errorf("prepare _LoginInfoA error: %w", err) } if obj.LoginInfoE, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_LoginInfoE))); err != nil { - return + return nil, fmt.Errorf("prepare _LoginInfoE error: %w", err) } return } @@ -173,19 +178,19 @@ func BuildShutter(p PreparexBuilder, ctx ...context.Context) (obj *Shutter, err TagsForIncr: p.QueryHook(_Shutter_TagsForIncr), } if obj.HotTags, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Shutter_HotTags))); err != nil { - return + return nil, fmt.Errorf("prepare _Shutter_HotTags error: %w", err) } if obj.TagsByKeywordA, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Shutter_TagsByKeywordA))); err != nil { - return + return nil, fmt.Errorf("prepare _Shutter_TagsByKeywordA error: %w", err) } if obj.TagsByKeywordB, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Shutter_TagsByKeywordB))); err != nil { - return + return nil, fmt.Errorf("prepare _Shutter_TagsByKeywordB error: %w", err) } if obj.InsertTag, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_Shutter_InsertTag))); err != nil { - return + return nil, fmt.Errorf("prepare _Shutter_InsertTag error: %w", err) } if obj.NewestTags, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_Shutter_NewestTags))); err != nil { - return + return nil, fmt.Errorf("prepare _Shutter_NewestTags error: %w", err) } return } @@ -205,19 +210,19 @@ func BuildTagsInfo(p PreparexBuilder, ctx ...context.Context) (obj *TagsInfo, er TagsForIncr: p.QueryHook(_TagsInfo_TagsForIncr), } if obj.HotTags, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TagsInfo_HotTags))); err != nil { - return + return nil, fmt.Errorf("prepare _TagsInfo_HotTags error: %w", err) } if obj.TagsByKeywordA, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TagsInfo_TagsByKeywordA))); err != nil { - return + return nil, fmt.Errorf("prepare _TagsInfo_TagsByKeywordA error: %w", err) } if obj.TagsByKeywordB, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TagsInfo_TagsByKeywordB))); err != nil { - return + return nil, fmt.Errorf("prepare _TagsInfo_TagsByKeywordB error: %w", err) } if obj.InsertTag, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_TagsInfo_InsertTag))); err != nil { - return + return nil, fmt.Errorf("prepare _TagsInfo_InsertTag error: %w", err) } if obj.NewestTags, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_TagsInfo_NewestTags))); err != nil { - return + return nil, fmt.Errorf("prepare _TagsInfo_NewestTags error: %w", err) } return } @@ -237,19 +242,19 @@ func BuildTopic(p PreparexBuilder, ctx ...context.Context) (obj *Topic, err erro TagsForIncr: p.QueryHook(_Topic_TagsForIncr), } if obj.HotTags, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Topic_HotTags))); err != nil { - return + return nil, fmt.Errorf("prepare _Topic_HotTags error: %w", err) } if obj.TagsByKeywordA, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Topic_TagsByKeywordA))); err != nil { - return + return nil, fmt.Errorf("prepare _Topic_TagsByKeywordA error: %w", err) } if obj.TagsByKeywordB, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Topic_TagsByKeywordB))); err != nil { - return + return nil, fmt.Errorf("prepare _Topic_TagsByKeywordB error: %w", err) } if obj.InsertTag, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_Topic_InsertTag))); err != nil { - return + return nil, fmt.Errorf("prepare _Topic_InsertTag error: %w", err) } if obj.NewestTags, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_Topic_NewestTags))); err != nil { - return + return nil, fmt.Errorf("prepare _Topic_NewestTags error: %w", err) } return } diff --git a/examples/go.mod b/examples/go.mod index 895584b..21d298b 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -3,7 +3,7 @@ module github.com/alimy/yesql/examples go 1.18 require ( - github.com/alimy/yesql v1.8.4 + github.com/alimy/yesql v1.8.5 github.com/bitbus/sqlx v1.6.0 ) diff --git a/template/sql.tmpl b/template/sql.tmpl index c7caf0d..f739ef8 100644 --- a/template/sql.tmpl +++ b/template/sql.tmpl @@ -6,11 +6,16 @@ package {{ .PkgName }} import ( "context" + "fmt" "database/sql" {{if .ScopeQueryNotEmpty}}"github.com/alimy/yesql"{{end}} ) +var ( + _ = fmt.Errorf("error for placeholder") +) + const ( {{range .AllQuery }}_{{if notEmptyStr .Scope}}{{ naming .Scope}}_{{end}}{{ naming .Name }} = `{{ escape .Query }}` {{end -}} @@ -47,7 +52,7 @@ func Build{{ .DefaultStructName }}(p yesql.PrepareBuilder{{if .DefaultQueryMap.I {{end}}}{{else}}{}{{end}} {{- range $name, $_ := .DefaultQueryMap.FilterByStyle "stmt" }} if obj.{{ naming $name }}, err = p.PrepareContext(c, p.QueryHook(_{{ naming $name }})); err != nil { - return + return nil, fmt.Errorf("prepare _{{ naming $name }} error: %w", err) }{{end}} return }{{end}} @@ -66,7 +71,7 @@ func Build{{ naming $scope }}(p yesql.PrepareBuilder{{if $queryMap.IsStmtQueryNo {{end}}}{{else}}{}{{end}} {{- range $name, $_ := $queryMap.FilterByStyle "stmt" }} if obj.{{ naming $name }}, err = p.PrepareContext(c, p.QueryHook(_{{ naming $scope }}_{{ naming $name }})); err != nil { - return + return nil, fmt.Errorf("prepare _{{ naming $scope }}_{{ naming $name }} error: %w", err) }{{end}} return } diff --git a/template/sqlx.tmpl b/template/sqlx.tmpl index 60782bc..59b8f02 100644 --- a/template/sqlx.tmpl +++ b/template/sqlx.tmpl @@ -6,11 +6,16 @@ package {{ .PkgName }} import ( "context" + "fmt" "{{ .SqlxPkgName }}" {{if .ScopeQueryNotEmpty}}"github.com/alimy/yesql"{{end}} ) +var ( + _ = fmt.Errorf("error for placeholder") +) + const ( {{range .AllQuery }}_{{if notEmptyStr .Scope}}{{ naming .Scope}}_{{end}}{{ naming .Name }} = `{{ escape .Query }}` {{end -}} @@ -71,11 +76,11 @@ func Build{{ .DefaultStructName }}(p PreparexBuilder{{if .DefaultQueryMap.IsStmt {{end}}}{{else}}{}{{end}} {{- range $name, $_ := .DefaultQueryMap.FilterByStyle "stmt" }} if obj.{{ naming $name }}, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_{{ naming $name }}))); err != nil { - return + return nil, fmt.Errorf("prepare _{{ naming $name }} error: %w", err) }{{end}} {{- range $name, $_ := .DefaultQueryMap.FilterByStyle "named_stmt" }} if obj.{{ naming $name }}, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_{{ naming $name }}))); err != nil { - return + return nil, fmt.Errorf("prepare _{{ naming $name }} error: %w", err) }{{end}} return }{{end}} @@ -94,11 +99,11 @@ func Build{{ naming $scope }}(p PreparexBuilder{{if $queryMap.IsStmtQueryNotEmpt {{end}}}{{else}}{}{{end}} {{- range $name, $_ := $queryMap.FilterByStyle "stmt" }} if obj.{{ naming $name }}, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_{{ naming $scope }}_{{ naming $name }}))); err != nil { - return + return nil, fmt.Errorf("prepare _{{ naming $scope }}_{{ naming $name }} error: %w", err) }{{end}} {{- range $name, $_ := $queryMap.FilterByStyle "named_stmt" }} if obj.{{ naming $name }}, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_{{ naming $scope }}_{{ naming $name }}))); err != nil { - return + return nil, fmt.Errorf("prepare _{{ naming $scope }}_{{ naming $name }} error: %w", err) }{{end}} return } diff --git a/version.go b/version.go index 1b8491e..2d3842d 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package yesql -var Version = "v1.8.4" +var Version = "v1.8.5"