Bluemage/go/converts/subreddit.go

22 lines
698 B
Go
Raw Normal View History

package converts
import (
"github.com/tigorlazuardi/bluemage/go/gen/models"
subreddits "github.com/tigorlazuardi/bluemage/go/gen/proto/subreddits/v1"
)
// goverter:converter
// goverter:extend BoolToInt8 SubredditTypeToString Int8ToBool PtrBoolToOmitInt8
// goverter:extend PtrStringToOmitString PtrFloat64ToOmitFloat64 PtrInt32ToOmitInt32
type SubredditConverter interface {
// goverter:ignore CreatedAt UpdatedAt R CoverImageID
CreateSubredditRequestToModelsSubreddit(*subreddits.CreateSubredditRequest) *models.Subreddit
}
func SubredditTypeToString(subType subreddits.SubredditType) string {
if subType == subreddits.SubredditType_SUBREDDIT_TYPE_USER {
return "user"
}
return "r"
}