Documentation ¶
Index ¶
- Constants
- func AuthMiddleware() *jwt.GinJWTMiddleware
- func AuthorsByBookGroup(bookGroupId, page int32) ([]int32, error)
- func BookAuthorById(id int32) (*db.BookAuthorByIdRow, error)
- func BookAuthors(page int32) ([]*db.BookAuthorsRow, error)
- func BookChapterById(id int32) (*db.BookChapter, error)
- func BookChaptersByBookGroupId(bookGroupID, page int32) ([]*db.BookChapter, error)
- func BookGroupAuthor(bookGroupId, bookAuthorId int32) (bool, error)
- func BookGroupById(id int32) (*db.BookGroupByIdRow, error)
- func BookGroupGenre(bookGroupId, genreId int32) (bool, error)
- func BookGroupsByGenre(genreId, page int32) (*[]db.BookGroupsByGenreRow, error)
- func BookGroupsByTitle(title string, page int32) ([]*db.BookGroupsByTitleRow, error)
- func ChangeCurrentUserInfoHandler(c *gin.Context)
- func ChangeCurrentUserPasswordHandler(c *gin.Context)
- func CheckAuthorExistById(id int32) (bool, error)
- func CheckEmptyString(content string) bool
- func CheckGenreExistById(id int32) (bool, error)
- func CheckImageExistById(id int32) (bool, error)
- func Clamp(input, min, max int32) int32
- func CleanImages() error
- func CleanSearchString(search string) string
- func CommentsByBookChapter(bookChapterId int32, page int)
- func CommentsByBookGroup(bookGroupId int32, page int)
- func CompleteOauthAccountHandler(c *gin.Context)
- func CompleteOauthRegistration(userId int32, name string, avatarId *int32, roleId int32) error
- func CountCommentInBookGroup(bookGroupId int32) (int32, error)
- func CountLikesInBookGroup(bookGroupId int32) (int64, error)
- func CreateAuthorHandler(c *gin.Context)
- func CreateBookAuthor(name, description string, imageID int32, alias interface{}) (*db.BookAuthor, error)
- func CreateBookChapter(chapterNumber float64, description, textContext, chapterType string, ...) (*db.BookChapter, error)
- func CreateBookGroup(input *InputBookGroup) (*db.InsertBookGroupRow, error)
- func CreateBookGroupArt(bookGroupId, imageId int32) (*db.BookGroupArt, error)
- func CreateBookGroupAuthor(bookGroupId, bookAuthorId int32) (*db.BookGroupAuthor, error)
- func CreateBookGroupGenre(bookGroupId, genreId int32) (*db.BookGroupGenre, error)
- func CreateBookGroupHandler(c *gin.Context)
- func CreateCommentHandler(c *gin.Context)
- func CreateGenre(name, description string, imageID int32) (*db.Genre, error)
- func CreateHypertextChapterHandler(c *gin.Context)
- func CreateImage(width int, height int) (*os.File, int64, string, string, error)
- func CreateImagesChapterHandler(c *gin.Context)
- func DeleteAccount(username string) error
- func DeleteAuthorHandler(c *gin.Context)
- func DeleteAuthorsByBookGroup(bookGroupId int32) error
- func DeleteBookAuthor(id int32) error
- func DeleteBookChapterByBookGroupId(bookGroupId int32) error
- func DeleteBookChapterHandler(c *gin.Context)
- func DeleteBookGroup(id int32) error
- func DeleteBookGroupAuthor(bookGroupId, bookAuthorId int32) error
- func DeleteBookGroupGenre(bookGroupId, genreId int32) error
- func DeleteBookGroupHandler(c *gin.Context)
- func DeleteBookGroupsByBookAuthor(genre int32) error
- func DeleteBookGroupsByGenre(genre int32) error
- func DeleteCommentHandler(c *gin.Context)
- func DeleteCoverOfBookGroup(bookGroupId int32) error
- func DeleteGenre(id int32) error
- func DeleteGenresByBookGroup(bookGroupId int32) error
- func DislikeBookGroup(params UserLikeParams) error
- func EditComment(commentId int32, content string) error
- func EditCommentHandler(c *gin.Context)
- func EqualPasswords(hashedPassword, password []byte) bool
- func GeneratePasswordHash(password string) ([]byte, error)
- func GenerateThumbnail(path string, size int, filetype *string) (string, error)
- func GenreById(id int32) (*db.Genre, error)
- func GenresByBookGroup(bookGroupId, page int32) ([]int32, error)
- func GetAuthorInfoHandler(c *gin.Context)
- func GetBookByGenreHandler(c *gin.Context)
- func GetBookChapterContentHandler(c *gin.Context)
- func GetBookGroupContentHandler(c *gin.Context)
- func GetBookGroupsByViewHandler(c *gin.Context)
- func GetCommentsHandler(c *gin.Context)
- func GetImageResolution(filestream multipart.File) (int, int, error)
- func GetLatestBookGroupsHandler(c *gin.Context)
- func GetLatestCommentsHandler(c *gin.Context)
- func GetRandomBookGroups(c *gin.Context)
- func GetRoleHandler(c *gin.Context)
- func GetSearchResultHandler(c *gin.Context)
- func GetSearchSuggestionHandler(c *gin.Context)
- func GetUserInfoByIdHandler(c *gin.Context)
- func GetViewInBookGroup(bookGroupId int32) (int64, error)
- func GoogleOauthRedirect(c *gin.Context)
- func HasControlCharacters(content string) bool
- func ImagesByBookChapter(bookChapterId int32) (*[]db.ImagesByBookChapterRow, error)
- func InitOauth()
- func InsertComment(params CommentParams) error
- func InsertView(chapterId int32) error
- func LikeBookGroup(params UserLikeParams) error
- func LikeOperationHandler(c *gin.Context)
- func ListAllGenresHandler(c *gin.Context)
- func NumberBookGroupInGenre(genreId int32) (int32, error)
- func RegisterAccount(username, password, email string) (*db.User, *db.RoleRow, error)
- func RegisterOauthAccount(email string) (*db.User, *db.RoleRow, error)
- func RegisterPasswordHandler(c *gin.Context)
- func RemoveComment(commentId int32) error
- func ReportError(c *gin.Context, err error, message string, code int)
- func ResizeImage(fileStream multipart.File, params ResizeImageParams) error
- func Run()
- func SaveImageFromStream(filestream multipart.File, location string, fileNameNoExt string, ...) (int32, string, error)
- func SaveImageFromUrl(fileUrl string, location string, fileNameNoExt string, description string) (int32, error)
- func SearchAuthorHandler(c *gin.Context)
- func SearchUserHandler(c *gin.Context)
- func SetRole(adminId int32, userId int32, role string) error
- func SetRoleHandler(c *gin.Context)
- func SubmitImages(submitImages []int32) error
- func TryOutsideTest()
- func UnlikeBookGroup(params UserLikeParams) error
- func UpdateAuthorHandler(c *gin.Context)
- func UpdateBookAuthor(id int32, name, description string, imageID int32, alias interface{}) error
- func UpdateBookChapter(chapter UpdateChapterParams) error
- func UpdateBookGroup(id int32, input *InputBookGroup) error
- func UpdateBookGroupHandler(c *gin.Context)
- func UpdateGenre(id int32, name, description string, imageID int32) error
- func UpdateHypertextChapter(c *gin.Context)
- func UpdateImagesChapterHandler(c *gin.Context)
- func UploadImageHandler(c *gin.Context)
- func UserByGoogleOauthCode(code string) (*db.User, *db.RoleRow, error)
- func UserByLoginInfo(loginInfo PasswordLogin) (*db.User, *db.RoleRow, error)
- func UserByOauthToken(login OauthLogin) (*db.User, *db.RoleRow, error)
- func ValidAuthors(authorIds *[]int32)
- func ValidCoverArt(coverArtIds *[]int32)
- func ValidDescription(description *string) error
- func ValidGenres(genreIds *[]int32)
- func ValidPassword(password string) bool
- func ValidPrimaryCoverArtId(PrimaryCoverArtId *int32, coverArtIds *[]int32)
- func ValidTitle(title *string) error
- func ValidUsername(username string) bool
- type Author
- type BookByGenreHandler
- type BookByUser
- type BookGroup
- type ChangePassword
- type ChangeUserInfo
- type Chapter
- type Comment
- type CommentPage
- type CommentParams
- type CompleteOauth
- type CreateAuthor
- type Genre
- type HypertextChapter
- type Image
- type ImageChapter
- type InputBookGroup
- type InsertViewParams
- type LatestComment
- type OauthLogin
- type PasswordLogin
- type PostComment
- type Register
- type ResizeImageParams
- type SetRoleInput
- type UpdateAuthor
- type UpdateChapterParams
- type User
- type UserClaims
- type UserInfo
- type UserLikeParams
- type UserProfile
Constants ¶
View Source
const ( WeekView = "week" MonthView = "month" YearView = "year" AllView = "all" )
View Source
const ( ChapterImage = "chapter-image" UserAvatar = "user-avatar" AuthorAvatar = "author-avatar" GenreImage = "genre-image" CoverArt = "cover-art" )
View Source
const ( Like = "like" DisLike = "dislike" Unlike = "unlike" )
View Source
const ( MemberRole = "member" ModeratorRole = "moderator" BannedRole = "banned" )
View Source
const ( BookGroupModule = "book" BookChapterModule = "chapter" CommentModule = "comment" AuthorModule = "author" LikeModule = "like" PostAction = "post" ReadAction = "read" ModifyAction = "modify" DeleteAction = "delete" ModifySelfAction = "modifySelf" DeleteSelfAction = "deleteSelf" )
View Source
const LimitUserBookGroups = 20
View Source
const MaxSize = 1024 * 1024 * 10
View Source
const RoleNameClaimKey = "rol"
View Source
const RolePermsClaimKey = "rolp"
View Source
const RootFolder = "static/images"
View Source
const UserIdClaimKey = "uid"
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware() *jwt.GinJWTMiddleware
AuthMiddleware is a jwt auth(enticator/orizator)
func AuthorsByBookGroup ¶
func BookAuthorById ¶
func BookAuthorById(id int32) (*db.BookAuthorByIdRow, error)
func BookAuthors ¶
func BookAuthors(page int32) ([]*db.BookAuthorsRow, error)
func BookChapterById ¶
func BookChapterById(id int32) (*db.BookChapter, error)
func BookChaptersByBookGroupId ¶
func BookChaptersByBookGroupId(bookGroupID, page int32) ([]*db.BookChapter, error)
func BookGroupAuthor ¶
func BookGroupById ¶
func BookGroupById(id int32) (*db.BookGroupByIdRow, error)
func BookGroupGenre ¶
func BookGroupsByGenre ¶
func BookGroupsByGenre(genreId, page int32) (*[]db.BookGroupsByGenreRow, error)
func BookGroupsByTitle ¶
func BookGroupsByTitle(title string, page int32) ([]*db.BookGroupsByTitleRow, error)
func CheckAuthorExistById ¶
func CheckEmptyString ¶
func CheckGenreExistById ¶
func CheckImageExistById ¶
func CleanImages ¶
func CleanImages() error
func CleanSearchString ¶
func CommentsByBookChapter ¶
func CommentsByBookGroup ¶
func CountCommentInBookGroup ¶
func CountLikesInBookGroup ¶
func CreateAuthorHandler ¶
func CreateBookAuthor ¶
func CreateBookAuthor(name, description string, imageID int32, alias interface{}) (*db.BookAuthor, error)
func CreateBookChapter ¶
func CreateBookGroup ¶
func CreateBookGroup(input *InputBookGroup) (*db.InsertBookGroupRow, error)
func CreateBookGroupArt ¶
func CreateBookGroupArt(bookGroupId, imageId int32) (*db.BookGroupArt, error)
func CreateBookGroupAuthor ¶
func CreateBookGroupAuthor(bookGroupId, bookAuthorId int32) (*db.BookGroupAuthor, error)
func CreateBookGroupGenre ¶
func CreateBookGroupGenre(bookGroupId, genreId int32) (*db.BookGroupGenre, error)
func CreateBookGroupHandler ¶
func CreateCommentHandler ¶
func DeleteAccount ¶
func DeleteAuthorHandler ¶
func DeleteBookAuthor ¶
func DeleteBookGroup ¶
func DeleteBookGroupAuthor ¶
func DeleteBookGroupGenre ¶
func DeleteBookGroupHandler ¶
func DeleteBookGroupsByGenre ¶
func DeleteCommentHandler ¶
func DeleteCoverOfBookGroup ¶
func DeleteGenre ¶
func DeleteGenresByBookGroup ¶
func DislikeBookGroup ¶
func DislikeBookGroup(params UserLikeParams) error
func EditComment ¶
func EditCommentHandler ¶
func EqualPasswords ¶
func GeneratePasswordHash ¶
func GenerateThumbnail ¶
func GenresByBookGroup ¶
func GetAuthorInfoHandler ¶
func GetBookByGenreHandler ¶
func GetCommentsHandler ¶
func GetRandomBookGroups ¶
func GetRoleHandler ¶
func GetSearchResultHandler ¶
func GetUserInfoByIdHandler ¶
func GetViewInBookGroup ¶
func GoogleOauthRedirect ¶
func HasControlCharacters ¶
func ImagesByBookChapter ¶
func ImagesByBookChapter(bookChapterId int32) (*[]db.ImagesByBookChapterRow, error)
func InsertComment ¶
func InsertComment(params CommentParams) error
func InsertView ¶
func LikeBookGroup ¶
func LikeBookGroup(params UserLikeParams) error
func LikeOperationHandler ¶
func ListAllGenresHandler ¶
func NumberBookGroupInGenre ¶
func RegisterAccount ¶
func RegisterPasswordHandler ¶
func RemoveComment ¶
func ResizeImage ¶
func ResizeImage(fileStream multipart.File, params ResizeImageParams) error
func SaveImageFromStream ¶
func SaveImageFromUrl ¶
func SearchAuthorHandler ¶
func SearchUserHandler ¶
func SetRoleHandler ¶
func SubmitImages ¶
func TryOutsideTest ¶
func TryOutsideTest()
func UnlikeBookGroup ¶
func UnlikeBookGroup(params UserLikeParams) error
func UpdateAuthorHandler ¶
func UpdateBookAuthor ¶
func UpdateBookChapter ¶
func UpdateBookChapter(chapter UpdateChapterParams) error
func UpdateBookGroup ¶
func UpdateBookGroup(id int32, input *InputBookGroup) error
func UpdateBookGroupHandler ¶
func UpdateHypertextChapter ¶
func UploadImageHandler ¶
func UserByLoginInfo ¶
func UserByOauthToken ¶
func ValidAuthors ¶
func ValidAuthors(authorIds *[]int32)
func ValidCoverArt ¶
func ValidCoverArt(coverArtIds *[]int32)
func ValidDescription ¶
func ValidGenres ¶
func ValidGenres(genreIds *[]int32)
func ValidPassword ¶
func ValidPrimaryCoverArtId ¶
func ValidTitle ¶
func ValidUsername ¶
Types ¶
type BookByGenreHandler ¶
type BookByUser ¶
type BookGroup ¶
type BookGroup struct { Name string `json:"name"` Alias interface{} `json:"alias"` Description interface{} `json:"description"` Views int64 `json:"views"` LikeCount int64 `json:"likeCount"` DislikeCount int64 `json:"dislikeCount"` OwnerId int32 `json:"ownerId"` Authors []Author `json:"authors"` Genres []Genre `json:"genres"` Chapters []Chapter `json:"chapters"` CoverArts []Image `json:"coverArts"` PrimaryCoverArt interface{} `json:"primaryCoverArt"` PrimaryCoverArtId interface{} `json:"primaryCoverArtId"` }
type ChangePassword ¶
type ChangeUserInfo ¶
type ChangeUserInfo struct { Email interface{} `json:"email"` Username interface{} `json:"username"` Description interface{} `json:"description"` Avatar interface{} `json:"avatar"` }
type Comment ¶
type Comment struct { CommentId int32 `json:"commentId" binding:"required"` Comment string `json:"comment" binding:"required"` UserName string `json:"userName" binding:"required"` UserId int32 `json:"userId" binding:"required"` UserAvatar interface{} `json:"userAvatar" binding:"required"` TimePosted int64 `json:"timePosted" binding:"required"` ChapterId interface{} `json:"chapterId"` ChapterNumber interface{} `json:"chapterNumber"` }
type CommentPage ¶
type CommentParams ¶
type CompleteOauth ¶
type CompleteOauth struct { Username string `json:"username" binding:"required" form:"username"` Avatar interface{} `json:"avatar" form:"avatar"` }
type CreateAuthor ¶
type HypertextChapter ¶
type ImageChapter ¶
type InputBookGroup ¶
type InputBookGroup struct { Title string `json:"name" form:"name"` Alias interface{} `json:"alias"` Description string `json:"description" form:"description"` AuthorIds []int32 `json:"authors" form:"authors"` GenreIds []int32 `json:"genres" form:"genres"` CoverArtIds []int32 `json:"coverArts" form:"coverArts"` PrimaryCoverArtId int32 `json:"primaryCoverArt" form:"primaryCoverArt"` OwnerId int32 `json:"owner" form:"owner"` }
type InsertViewParams ¶
type LatestComment ¶
type LatestComment struct { CommentId int32 `json:"commentId" binding:"required"` Comment string `json:"comment" binding:"required"` UserName string `json:"userName" binding:"required"` UserId int32 `json:"userId" binding:"required"` UserAvatar interface{} `json:"userAvatar" binding:"required"` TimePosted int64 `json:"timePosted" binding:"required"` ChapterId interface{} `json:"chapterId"` ChapterName interface{} `json:"chapterName"` ChapterNumber interface{} `json:"chapterNumber"` BookId int32 `json:"bookId" binding:"required"` BookName string `json:"bookName" binding:"required"` }
type OauthLogin ¶
type PasswordLogin ¶
type PostComment ¶
type PostComment struct {
Comment string `json:"comment" binding:"required"`
}
type ResizeImageParams ¶
type SetRoleInput ¶
type UpdateAuthor ¶
type UpdateChapterParams ¶
type UserClaims ¶
type UserLikeParams ¶
type UserProfile ¶
type UserProfile struct { Name string `json:"name"` Role string `json:"role"` Avatar interface{} `json:"avatar"` AvatarId interface{} `json:"avatarId"` Description interface{} `json:"description"` BookPosted []BookByUser `json:"bookPosted"` }
Click to show internal directories.
Click to hide internal directories.