Use correct type for enum generation
This commit is contained in:
parent
a355158d88
commit
a8997d12ee
@ -4,8 +4,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.arsenm.dev/go-lemmy/cmd/gen/parser"
|
|
||||||
"github.com/dave/jennifer/jen"
|
"github.com/dave/jennifer/jen"
|
||||||
|
"go.arsenm.dev/go-lemmy/cmd/gen/parser"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StructGenerator struct {
|
type StructGenerator struct {
|
||||||
@ -47,7 +47,7 @@ func (s *StructGenerator) Generate(items []parser.Item) error {
|
|||||||
|
|
||||||
f.Const().DefsFunc(func(g *jen.Group) {
|
f.Const().DefsFunc(func(g *jen.Group) {
|
||||||
for _, member := range e.Members {
|
for _, member := range e.Members {
|
||||||
g.Id(e.Name + string(member)).Op("=").Lit(string(member))
|
g.Id(e.Name + string(member)).Id(e.Name).Op("=").Lit(string(member))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -3,34 +3,34 @@ package types
|
|||||||
type SortType string
|
type SortType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SortTypeActive = "Active"
|
SortTypeActive SortType = "Active"
|
||||||
SortTypeHot = "Hot"
|
SortTypeHot SortType = "Hot"
|
||||||
SortTypeNew = "New"
|
SortTypeNew SortType = "New"
|
||||||
SortTypeTopDay = "TopDay"
|
SortTypeTopDay SortType = "TopDay"
|
||||||
SortTypeTopWeek = "TopWeek"
|
SortTypeTopWeek SortType = "TopWeek"
|
||||||
SortTypeTopMonth = "TopMonth"
|
SortTypeTopMonth SortType = "TopMonth"
|
||||||
SortTypeTopYear = "TopYear"
|
SortTypeTopYear SortType = "TopYear"
|
||||||
SortTypeTopAll = "TopAll"
|
SortTypeTopAll SortType = "TopAll"
|
||||||
SortTypeMostComments = "MostComments"
|
SortTypeMostComments SortType = "MostComments"
|
||||||
SortTypeNewComments = "NewComments"
|
SortTypeNewComments SortType = "NewComments"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ListingType string
|
type ListingType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ListingTypeAll = "All"
|
ListingTypeAll ListingType = "All"
|
||||||
ListingTypeLocal = "Local"
|
ListingTypeLocal ListingType = "Local"
|
||||||
ListingTypeSubscribed = "Subscribed"
|
ListingTypeSubscribed ListingType = "Subscribed"
|
||||||
ListingTypeCommunity = "Community"
|
ListingTypeCommunity ListingType = "Community"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SearchType string
|
type SearchType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SearchTypeAll = "All"
|
SearchTypeAll SearchType = "All"
|
||||||
SearchTypeComments = "Comments"
|
SearchTypeComments SearchType = "Comments"
|
||||||
SearchTypePosts = "Posts"
|
SearchTypePosts SearchType = "Posts"
|
||||||
SearchTypeCommunities = "Communities"
|
SearchTypeCommunities SearchType = "Communities"
|
||||||
SearchTypeUsers = "Users"
|
SearchTypeUsers SearchType = "Users"
|
||||||
SearchTypeUrl = "Url"
|
SearchTypeUrl SearchType = "Url"
|
||||||
)
|
)
|
||||||
|
@ -3,88 +3,88 @@ package types
|
|||||||
type UserOperation string
|
type UserOperation string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
UserOperationLogin = "Login"
|
UserOperationLogin UserOperation = "Login"
|
||||||
UserOperationGetCaptcha = "GetCaptcha"
|
UserOperationGetCaptcha UserOperation = "GetCaptcha"
|
||||||
UserOperationMarkCommentAsRead = "MarkCommentAsRead"
|
UserOperationMarkCommentAsRead UserOperation = "MarkCommentAsRead"
|
||||||
UserOperationSaveComment = "SaveComment"
|
UserOperationSaveComment UserOperation = "SaveComment"
|
||||||
UserOperationCreateCommentLike = "CreateCommentLike"
|
UserOperationCreateCommentLike UserOperation = "CreateCommentLike"
|
||||||
UserOperationCreateCommentReport = "CreateCommentReport"
|
UserOperationCreateCommentReport UserOperation = "CreateCommentReport"
|
||||||
UserOperationResolveCommentReport = "ResolveCommentReport"
|
UserOperationResolveCommentReport UserOperation = "ResolveCommentReport"
|
||||||
UserOperationListCommentReports = "ListCommentReports"
|
UserOperationListCommentReports UserOperation = "ListCommentReports"
|
||||||
UserOperationCreatePostLike = "CreatePostLike"
|
UserOperationCreatePostLike UserOperation = "CreatePostLike"
|
||||||
UserOperationLockPost = "LockPost"
|
UserOperationLockPost UserOperation = "LockPost"
|
||||||
UserOperationStickyPost = "StickyPost"
|
UserOperationStickyPost UserOperation = "StickyPost"
|
||||||
UserOperationMarkPostAsRead = "MarkPostAsRead"
|
UserOperationMarkPostAsRead UserOperation = "MarkPostAsRead"
|
||||||
UserOperationSavePost = "SavePost"
|
UserOperationSavePost UserOperation = "SavePost"
|
||||||
UserOperationCreatePostReport = "CreatePostReport"
|
UserOperationCreatePostReport UserOperation = "CreatePostReport"
|
||||||
UserOperationResolvePostReport = "ResolvePostReport"
|
UserOperationResolvePostReport UserOperation = "ResolvePostReport"
|
||||||
UserOperationListPostReports = "ListPostReports"
|
UserOperationListPostReports UserOperation = "ListPostReports"
|
||||||
UserOperationGetReportCount = "GetReportCount"
|
UserOperationGetReportCount UserOperation = "GetReportCount"
|
||||||
UserOperationGetUnreadCount = "GetUnreadCount"
|
UserOperationGetUnreadCount UserOperation = "GetUnreadCount"
|
||||||
UserOperationVerifyEmail = "VerifyEmail"
|
UserOperationVerifyEmail UserOperation = "VerifyEmail"
|
||||||
UserOperationFollowCommunity = "FollowCommunity"
|
UserOperationFollowCommunity UserOperation = "FollowCommunity"
|
||||||
UserOperationGetReplies = "GetReplies"
|
UserOperationGetReplies UserOperation = "GetReplies"
|
||||||
UserOperationGetPersonMentions = "GetPersonMentions"
|
UserOperationGetPersonMentions UserOperation = "GetPersonMentions"
|
||||||
UserOperationMarkPersonMentionAsRead = "MarkPersonMentionAsRead"
|
UserOperationMarkPersonMentionAsRead UserOperation = "MarkPersonMentionAsRead"
|
||||||
UserOperationGetModlog = "GetModlog"
|
UserOperationGetModlog UserOperation = "GetModlog"
|
||||||
UserOperationBanFromCommunity = "BanFromCommunity"
|
UserOperationBanFromCommunity UserOperation = "BanFromCommunity"
|
||||||
UserOperationAddModToCommunity = "AddModToCommunity"
|
UserOperationAddModToCommunity UserOperation = "AddModToCommunity"
|
||||||
UserOperationAddAdmin = "AddAdmin"
|
UserOperationAddAdmin UserOperation = "AddAdmin"
|
||||||
UserOperationGetUnreadRegistrationApplicationCount = "GetUnreadRegistrationApplicationCount"
|
UserOperationGetUnreadRegistrationApplicationCount UserOperation = "GetUnreadRegistrationApplicationCount"
|
||||||
UserOperationListRegistrationApplications = "ListRegistrationApplications"
|
UserOperationListRegistrationApplications UserOperation = "ListRegistrationApplications"
|
||||||
UserOperationApproveRegistrationApplication = "ApproveRegistrationApplication"
|
UserOperationApproveRegistrationApplication UserOperation = "ApproveRegistrationApplication"
|
||||||
UserOperationBanPerson = "BanPerson"
|
UserOperationBanPerson UserOperation = "BanPerson"
|
||||||
UserOperationGetBannedPersons = "GetBannedPersons"
|
UserOperationGetBannedPersons UserOperation = "GetBannedPersons"
|
||||||
UserOperationSearch = "Search"
|
UserOperationSearch UserOperation = "Search"
|
||||||
UserOperationResolveObject = "ResolveObject"
|
UserOperationResolveObject UserOperation = "ResolveObject"
|
||||||
UserOperationMarkAllAsRead = "MarkAllAsRead"
|
UserOperationMarkAllAsRead UserOperation = "MarkAllAsRead"
|
||||||
UserOperationSaveUserSettings = "SaveUserSettings"
|
UserOperationSaveUserSettings UserOperation = "SaveUserSettings"
|
||||||
UserOperationTransferCommunity = "TransferCommunity"
|
UserOperationTransferCommunity UserOperation = "TransferCommunity"
|
||||||
UserOperationLeaveAdmin = "LeaveAdmin"
|
UserOperationLeaveAdmin UserOperation = "LeaveAdmin"
|
||||||
UserOperationPasswordReset = "PasswordReset"
|
UserOperationPasswordReset UserOperation = "PasswordReset"
|
||||||
UserOperationPasswordChange = "PasswordChange"
|
UserOperationPasswordChange UserOperation = "PasswordChange"
|
||||||
UserOperationMarkPrivateMessageAsRead = "MarkPrivateMessageAsRead"
|
UserOperationMarkPrivateMessageAsRead UserOperation = "MarkPrivateMessageAsRead"
|
||||||
UserOperationUserJoin = "UserJoin"
|
UserOperationUserJoin UserOperation = "UserJoin"
|
||||||
UserOperationGetSiteConfig = "GetSiteConfig"
|
UserOperationGetSiteConfig UserOperation = "GetSiteConfig"
|
||||||
UserOperationSaveSiteConfig = "SaveSiteConfig"
|
UserOperationSaveSiteConfig UserOperation = "SaveSiteConfig"
|
||||||
UserOperationPostJoin = "PostJoin"
|
UserOperationPostJoin UserOperation = "PostJoin"
|
||||||
UserOperationCommunityJoin = "CommunityJoin"
|
UserOperationCommunityJoin UserOperation = "CommunityJoin"
|
||||||
UserOperationModJoin = "ModJoin"
|
UserOperationModJoin UserOperation = "ModJoin"
|
||||||
UserOperationChangePassword = "ChangePassword"
|
UserOperationChangePassword UserOperation = "ChangePassword"
|
||||||
UserOperationGetSiteMetadata = "GetSiteMetadata"
|
UserOperationGetSiteMetadata UserOperation = "GetSiteMetadata"
|
||||||
UserOperationBlockCommunity = "BlockCommunity"
|
UserOperationBlockCommunity UserOperation = "BlockCommunity"
|
||||||
UserOperationBlockPerson = "BlockPerson"
|
UserOperationBlockPerson UserOperation = "BlockPerson"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserOperationCrud string
|
type UserOperationCrud string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
UserOperationCrudCreateSite = "CreateSite"
|
UserOperationCrudCreateSite UserOperationCrud = "CreateSite"
|
||||||
UserOperationCrudGetSite = "GetSite"
|
UserOperationCrudGetSite UserOperationCrud = "GetSite"
|
||||||
UserOperationCrudEditSite = "EditSite"
|
UserOperationCrudEditSite UserOperationCrud = "EditSite"
|
||||||
UserOperationCrudCreateCommunity = "CreateCommunity"
|
UserOperationCrudCreateCommunity UserOperationCrud = "CreateCommunity"
|
||||||
UserOperationCrudListCommunities = "ListCommunities"
|
UserOperationCrudListCommunities UserOperationCrud = "ListCommunities"
|
||||||
UserOperationCrudGetCommunity = "GetCommunity"
|
UserOperationCrudGetCommunity UserOperationCrud = "GetCommunity"
|
||||||
UserOperationCrudEditCommunity = "EditCommunity"
|
UserOperationCrudEditCommunity UserOperationCrud = "EditCommunity"
|
||||||
UserOperationCrudDeleteCommunity = "DeleteCommunity"
|
UserOperationCrudDeleteCommunity UserOperationCrud = "DeleteCommunity"
|
||||||
UserOperationCrudRemoveCommunity = "RemoveCommunity"
|
UserOperationCrudRemoveCommunity UserOperationCrud = "RemoveCommunity"
|
||||||
UserOperationCrudCreatePost = "CreatePost"
|
UserOperationCrudCreatePost UserOperationCrud = "CreatePost"
|
||||||
UserOperationCrudGetPost = "GetPost"
|
UserOperationCrudGetPost UserOperationCrud = "GetPost"
|
||||||
UserOperationCrudGetPosts = "GetPosts"
|
UserOperationCrudGetPosts UserOperationCrud = "GetPosts"
|
||||||
UserOperationCrudEditPost = "EditPost"
|
UserOperationCrudEditPost UserOperationCrud = "EditPost"
|
||||||
UserOperationCrudDeletePost = "DeletePost"
|
UserOperationCrudDeletePost UserOperationCrud = "DeletePost"
|
||||||
UserOperationCrudRemovePost = "RemovePost"
|
UserOperationCrudRemovePost UserOperationCrud = "RemovePost"
|
||||||
UserOperationCrudCreateComment = "CreateComment"
|
UserOperationCrudCreateComment UserOperationCrud = "CreateComment"
|
||||||
UserOperationCrudGetComment = "GetComment"
|
UserOperationCrudGetComment UserOperationCrud = "GetComment"
|
||||||
UserOperationCrudGetComments = "GetComments"
|
UserOperationCrudGetComments UserOperationCrud = "GetComments"
|
||||||
UserOperationCrudEditComment = "EditComment"
|
UserOperationCrudEditComment UserOperationCrud = "EditComment"
|
||||||
UserOperationCrudDeleteComment = "DeleteComment"
|
UserOperationCrudDeleteComment UserOperationCrud = "DeleteComment"
|
||||||
UserOperationCrudRemoveComment = "RemoveComment"
|
UserOperationCrudRemoveComment UserOperationCrud = "RemoveComment"
|
||||||
UserOperationCrudRegister = "Register"
|
UserOperationCrudRegister UserOperationCrud = "Register"
|
||||||
UserOperationCrudGetPersonDetails = "GetPersonDetails"
|
UserOperationCrudGetPersonDetails UserOperationCrud = "GetPersonDetails"
|
||||||
UserOperationCrudDeleteAccount = "DeleteAccount"
|
UserOperationCrudDeleteAccount UserOperationCrud = "DeleteAccount"
|
||||||
UserOperationCrudCreatePrivateMessage = "CreatePrivateMessage"
|
UserOperationCrudCreatePrivateMessage UserOperationCrud = "CreatePrivateMessage"
|
||||||
UserOperationCrudGetPrivateMessages = "GetPrivateMessages"
|
UserOperationCrudGetPrivateMessages UserOperationCrud = "GetPrivateMessages"
|
||||||
UserOperationCrudEditPrivateMessage = "EditPrivateMessage"
|
UserOperationCrudEditPrivateMessage UserOperationCrud = "EditPrivateMessage"
|
||||||
UserOperationCrudDeletePrivateMessage = "DeletePrivateMessage"
|
UserOperationCrudDeletePrivateMessage UserOperationCrud = "DeletePrivateMessage"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user