Documentation
¶
Overview ¶
Package sonolus 提供基于 Gin 的 Sonolus 服务器构建工具。
Index ¶
- Variables
- func InstallRedirectShare(router gin.IRouter, root string)
- func InstallSpaShare(router gin.IRouter, root string)
- func PaginateItems[T any](items []T, page int, perPage int) (int, []T)
- type AuthenticateHandler
- type BackgroundItemModel
- type BaseResolver
- type CollectionItemOption
- type CommunityCommentListHandler
- type CommunityCommentListModel
- type CommunityCommentModel
- type CommunityInfoHandler
- type CommunityInfoModel
- type Configuration
- type Context
- type CreateItemHandler
- type EffectItemModel
- type EngineItemModel
- type FileOption
- type FilterItems
- type FormModel
- type FormValue
- type FormsModel
- type ItemDetailsHandler
- type ItemDetailsModel
- type ItemGroup
- type ItemGroupOptions
- type ItemInfoHandler
- type ItemInfoModel
- type ItemListHandler
- type ItemListModel
- type ItemModel
- type ItemSectionModel
- type ItemSectionSearch
- type LeaderboardDetailsHandler
- type LeaderboardDetailsModel
- type LeaderboardRecordDetailsHandler
- type LeaderboardRecordDetailsModel
- type LeaderboardRecordListHandler
- type LeaderboardRecordListModel
- type LeaderboardRecordModel
- type LevelItemModel
- type LevelResult
- type LevelResultInfoModel
- type LevelResultOptions
- type Localize
- type MultiOption
- type MultiOptionValue
- type MultiOptionValueModel
- type Multiplayer
- type OptionBase
- type OptionModel
- type Options
- type OptionsModel
- type ParticleItemModel
- type PickForms
- type PlaylistItemModel
- type PostItemModel
- type PreUploadCommunityActionHandler
- type PreUploadCommunityCommentActionHandler
- type PreUploadItemActionHandler
- type PreUploadItemHandler
- type ReplayItemModel
- type RoomItemModel
- type SelectOption
- type SelectOptionValue
- type ServerError
- type ServerInfoHandler
- type ServerInfoModel
- type ServerItemOption
- type ServerItemsOption
- type SessionHandler
- type SkinItemModel
- type SliderOption
- type Sonolus
- func (s *Sonolus) AddBytes(data []byte, hash string) core.Srl
- func (s *Sonolus) AddFile(path string, hash string) (core.Srl, error)
- func (s *Sonolus) AddressValue() string
- func (s *Sonolus) BackgroundItems() []BackgroundItemModel
- func (s *Sonolus) EffectItems() []EffectItemModel
- func (s *Sonolus) EngineItems() []EngineItemModel
- func (s *Sonolus) FallbackLocaleValue() string
- func (s *Sonolus) Handler() http.Handler
- func (s *Sonolus) Install(router gin.IRouter)
- func (s *Sonolus) LevelItems() []LevelItemModel
- func (s *Sonolus) Load(path string) error
- func (s *Sonolus) Localize(text database.LocalizationText, locale string) string
- func (s *Sonolus) ParticleItems() []ParticleItemModel
- func (s *Sonolus) PlaylistItems() []PlaylistItemModel
- func (s *Sonolus) PostItems() []PostItemModel
- func (s *Sonolus) ReplayItems() []ReplayItemModel
- func (s *Sonolus) RoomItems() []RoomItemModel
- func (s *Sonolus) SkinItems() []SkinItemModel
- func (s *Sonolus) UserItems() []UserItemModel
- type SubmitCommunityActionHandler
- type SubmitCommunityCommentActionHandler
- type SubmitItemActionHandler
- type TextAreaOption
- type TextOption
- type ToItem
- type ToggleOption
- type UploadCommunityActionHandler
- type UploadCommunityCommentActionHandler
- type UploadItemActionHandler
- type UploadItemHandler
- type UploadOptions
- type UploadedFile
- type UserItemModel
Constants ¶
This section is empty.
Variables ¶
View Source
var ParseFormValue = model.ParseFormValue
View Source
var ParseFormsValue = model.ParseFormsValue
View Source
var ParseOptionsValue = model.ParseOptionsValue
View Source
var ParseSearchesValue = model.ParseSearchesValue
View Source
var SerializeRawFormValue = model.SerializeRawFormValue
View Source
var ToBackgroundItem = model.ToBackgroundItem
View Source
var ToEffectItem = model.ToEffectItem
View Source
var ToEngineItem = model.ToEngineItem
View Source
var ToLevelItem = model.ToLevelItem
View Source
var ToParticleItem = model.ToParticleItem
View Source
var ToPlaylistItem = model.ToPlaylistItem
View Source
var ToPostItem = model.ToPostItem
View Source
var ToReplayItem = model.ToReplayItem
View Source
var ToRoomItem = model.ToRoomItem
View Source
var ToServerForm = model.ToServerForm
View Source
var ToServerForms = model.ToServerForms
View Source
var ToSkinItem = model.ToSkinItem
View Source
var ToTags = model.ToTags
View Source
var ToUserItem = model.ToUserItem
Functions ¶
func InstallRedirectShare ¶
func InstallSpaShare ¶
Types ¶
type AuthenticateHandler ¶
type AuthenticateHandler func(Context, coreserver.ServiceUserProfile) (coreserver.ServerAuthenticateResponse, *ServerError)
type BackgroundItemModel ¶
type BackgroundItemModel = model.BackgroundItemModel
type BaseResolver ¶
type BaseResolver = model.BaseResolver
type CollectionItemOption ¶
type CollectionItemOption = model.CollectionItemOption
type CommunityCommentListHandler ¶
type CommunityCommentListHandler func(Context, string, int, string) (CommunityCommentListModel, *ServerError)
type CommunityCommentListModel ¶
type CommunityCommentListModel struct {
PageCount int
Cursor string
Comments []CommunityCommentModel
}
type CommunityCommentModel ¶
type CommunityCommentModel struct {
Name string
Author database.LocalizationText
AuthorUser string
Time float64
Content database.LocalizationText
Actions PickForms
}
type CommunityInfoHandler ¶
type CommunityInfoHandler func(Context, string) (CommunityInfoModel, *ServerError)
type CommunityInfoModel ¶
type CommunityInfoModel struct {
Actions PickForms
TopComments []CommunityCommentModel
}
type Configuration ¶
type Configuration struct {
Options OptionsModel
}
type Context ¶
type Context struct {
Session string
Localization string
Options map[string]any
RawOptions map[string]any
// contains filtered or unexported fields
}
Context contains Sonolus request metadata extracted from headers and query.
type CreateItemHandler ¶
type CreateItemHandler func(Context, FormValue) (coreserver.ServerCreateItemResponse, *ServerError)
type EffectItemModel ¶
type EffectItemModel = model.EffectItemModel
type EngineItemModel ¶
type EngineItemModel = model.EngineItemModel
type FileOption ¶
type FileOption = model.FileOption
type FilterItems ¶
type FilterItems[T any] = model.FilterItems[T]
func CreateFilterItems ¶
func CreateFilterItems[T any](props ...string) FilterItems[T]
type FormsModel ¶
type FormsModel = model.FormsModel
type ItemDetailsHandler ¶
type ItemDetailsHandler[T ItemModel] func(Context, string) (ItemDetailsModel[T], *ServerError)
type ItemDetailsModel ¶
type ItemDetailsModel[T ItemModel] struct { Item T Description database.LocalizationText Actions PickForms HasCommunity bool Leaderboards []coreserver.ServerItemLeaderboard Sections []ItemSectionModel }
type ItemGroup ¶
type ItemGroup[T ItemModel, R any] struct { Type core.ItemType Path string Items []T Creates FormsModel Searches FormsModel Actions FormsModel CommunityActions FormsModel CommunityCommentActions FormsModel InfoHandler ItemInfoHandler[T] ListHandler ItemListHandler[T] DetailsHandler ItemDetailsHandler[T] CreateHandler CreateItemHandler PreUploadHandler PreUploadItemHandler UploadHandler UploadItemHandler SubmitActionHandler SubmitItemActionHandler PreUploadActionHandler PreUploadItemActionHandler UploadActionHandler UploadItemActionHandler CommunityInfoHandler CommunityInfoHandler SubmitCommunityActionHandler SubmitCommunityActionHandler PreUploadCommunityActionHandler PreUploadCommunityActionHandler UploadCommunityActionHandler UploadCommunityActionHandler CommunityCommentListHandler CommunityCommentListHandler SubmitCommunityCommentActionHandler SubmitCommunityCommentActionHandler PreUploadCommunityCommentActionHandler PreUploadCommunityCommentActionHandler UploadCommunityCommentActionHandler UploadCommunityCommentActionHandler LeaderboardDetailsHandler LeaderboardDetailsHandler LeaderboardRecordListHandler LeaderboardRecordListHandler LeaderboardRecordDetailsHandler LeaderboardRecordDetailsHandler ToItem ToItem[T, R] Filter FilterItems[T] }
func NewItemGroup ¶
func NewItemGroup[T ItemModel, R any](typ core.ItemType, path string, options ItemGroupOptions, toItem ToItem[T, R], filter FilterItems[T]) *ItemGroup[T, R]
type ItemGroupOptions ¶
type ItemGroupOptions struct {
Creates FormsModel
Searches FormsModel
Actions FormsModel
Community struct {
Actions FormsModel
Comment struct {
Actions FormsModel
}
}
}
type ItemInfoHandler ¶
type ItemInfoHandler[T ItemModel] func(Context, string) (ItemInfoModel[T], *ServerError)
type ItemInfoModel ¶
type ItemInfoModel[T ItemModel] struct { Title database.LocalizationText Creates PickForms Searches PickForms QuickSearchValue FormValue Sections []ItemSectionModel Banner *core.Srl }
type ItemListHandler ¶
type ItemListHandler[T ItemModel] func(Context, FormValue, int, string) (ItemListModel[T], *ServerError)
type ItemListModel ¶
type ItemSectionModel ¶
type ItemSectionModel struct {
Title database.LocalizationText
Icon core.Icon
Description database.LocalizationText
Help database.LocalizationText
ItemType core.ItemType
Items any
Search *ItemSectionSearch
}
type ItemSectionSearch ¶
type LeaderboardDetailsHandler ¶
type LeaderboardDetailsHandler func(Context, string, string) (LeaderboardDetailsModel, *ServerError)
type LeaderboardDetailsModel ¶
type LeaderboardDetailsModel struct {
TopRecords []LeaderboardRecordModel
}
type LeaderboardRecordDetailsHandler ¶
type LeaderboardRecordDetailsHandler func(Context, string, string, string) (LeaderboardRecordDetailsModel, *ServerError)
type LeaderboardRecordDetailsModel ¶
type LeaderboardRecordDetailsModel struct {
Replays []ReplayItemModel
}
type LeaderboardRecordListHandler ¶
type LeaderboardRecordListHandler func(Context, string, string, int, string) (LeaderboardRecordListModel, *ServerError)
type LeaderboardRecordListModel ¶
type LeaderboardRecordListModel struct {
PageCount int
Cursor string
Records []LeaderboardRecordModel
}
type LeaderboardRecordModel ¶
type LeaderboardRecordModel struct {
Name string
Rank database.LocalizationText
Player string
PlayerUser string
Value database.LocalizationText
}
type LevelItemModel ¶
type LevelItemModel = model.LevelItemModel
type LevelResult ¶
type LevelResult struct {
Submits FormsModel
InfoHandler func(Context) (LevelResultInfoModel, *ServerError)
SubmitHandler func(Context, resource.ReplayItem, FormValue) (coreserver.ServerSubmitLevelResultResponse, *ServerError)
PreUploadHandler func(Context, string) *ServerError
UploadHandler func(Context, string, []*UploadedFile) (coreserver.ServerUploadLevelResultResponse, *ServerError)
}
func NewLevelResult ¶
func NewLevelResult(options LevelResultOptions) *LevelResult
type LevelResultInfoModel ¶
type LevelResultInfoModel struct {
Submits PickForms
}
type LevelResultOptions ¶
type LevelResultOptions struct {
Submits FormsModel
}
type MultiOption ¶
type MultiOption = model.MultiOption
type MultiOptionValue ¶
type MultiOptionValue = model.MultiOptionValue
type MultiOptionValueModel ¶
type MultiOptionValueModel = model.MultiOptionValueModel
type Multiplayer ¶
type Multiplayer struct {
CreateHandler func(Context) (coreserver.ServerCreateRoomResponse, *ServerError)
JoinHandler func(Context, string, coreserver.ServiceUserProfile, []byte, []byte, *FormValue) (coreserver.ServerJoinRoomResponse, *ServerError)
}
type OptionBase ¶
type OptionBase = model.OptionBase
type OptionModel ¶
type OptionModel = model.OptionModel
type Options ¶
type Options struct {
Address string
FallbackLocale string
Configuration Configuration
Upload UploadOptions
Post ItemGroupOptions
Playlist ItemGroupOptions
Level ItemGroupOptions
Skin ItemGroupOptions
Background ItemGroupOptions
Effect ItemGroupOptions
Particle ItemGroupOptions
Engine ItemGroupOptions
Replay ItemGroupOptions
Room ItemGroupOptions
User ItemGroupOptions
LevelResult LevelResultOptions
}
type OptionsModel ¶
type OptionsModel = model.OptionsModel
type ParticleItemModel ¶
type ParticleItemModel = model.ParticleItemModel
type PlaylistItemModel ¶
type PlaylistItemModel = model.PlaylistItemModel
type PostItemModel ¶
type PostItemModel = model.PostItemModel
type PreUploadCommunityActionHandler ¶
type PreUploadCommunityActionHandler func(Context, string, string) *ServerError
type PreUploadCommunityCommentActionHandler ¶
type PreUploadCommunityCommentActionHandler func(Context, string, string, string) *ServerError
type PreUploadItemActionHandler ¶
type PreUploadItemActionHandler func(Context, string, string) *ServerError
type PreUploadItemHandler ¶
type PreUploadItemHandler func(Context, string) *ServerError
type ReplayItemModel ¶
type ReplayItemModel = model.ReplayItemModel
type RoomItemModel ¶
type RoomItemModel = model.RoomItemModel
type SelectOption ¶
type SelectOption = model.SelectOption
type SelectOptionValue ¶
type SelectOptionValue = model.SelectOptionValue
type ServerError ¶
type ServerError struct {
Status int
Message database.LocalizationText
}
func MessageError ¶
func MessageError(status int, message database.LocalizationText) *ServerError
func StatusError ¶
func StatusError(status int) *ServerError
type ServerInfoHandler ¶
type ServerInfoHandler func(Context) (ServerInfoModel, *ServerError)
type ServerInfoModel ¶
type ServerInfoModel struct {
Title database.LocalizationText
Description database.LocalizationText
Buttons []coreserver.ServerInfoButton
Configuration struct {
Options OptionsModel
}
Banner *core.Srl
}
type ServerItemOption ¶
type ServerItemOption = model.ServerItemOption
type ServerItemsOption ¶
type ServerItemsOption = model.ServerItemsOption
type SessionHandler ¶
type SessionHandler func(Context) *ServerError
type SkinItemModel ¶
type SkinItemModel = model.SkinItemModel
type SliderOption ¶
type SliderOption = model.SliderOption
type Sonolus ¶
type Sonolus struct {
Address string
FallbackLocale string
Configuration Configuration
Router gin.IRouter
Title database.LocalizationText
Description database.LocalizationText
Banner *core.Srl
SessionHandler SessionHandler
AuthenticateHandler AuthenticateHandler
ServerInfoHandler ServerInfoHandler
Post *ItemGroup[PostItemModel, resource.PostItem]
Playlist *ItemGroup[PlaylistItemModel, resource.PlaylistItem]
Level *ItemGroup[LevelItemModel, resource.LevelItem]
Skin *ItemGroup[SkinItemModel, resource.SkinItem]
Background *ItemGroup[BackgroundItemModel, resource.BackgroundItem]
Effect *ItemGroup[EffectItemModel, resource.EffectItem]
Particle *ItemGroup[ParticleItemModel, resource.ParticleItem]
Engine *ItemGroup[EngineItemModel, resource.EngineItem]
Replay *ItemGroup[ReplayItemModel, resource.ReplayItem]
Room *ItemGroup[RoomItemModel, resource.RoomItem]
User *ItemGroup[UserItemModel, resource.UserItem]
Multiplayer *Multiplayer
LevelResult *LevelResult
// contains filtered or unexported fields
}
func (*Sonolus) AddressValue ¶
func (*Sonolus) BackgroundItems ¶
func (s *Sonolus) BackgroundItems() []BackgroundItemModel
func (*Sonolus) EffectItems ¶
func (s *Sonolus) EffectItems() []EffectItemModel
func (*Sonolus) EngineItems ¶
func (s *Sonolus) EngineItems() []EngineItemModel
func (*Sonolus) FallbackLocaleValue ¶
func (*Sonolus) LevelItems ¶
func (s *Sonolus) LevelItems() []LevelItemModel
func (*Sonolus) Localize ¶
func (s *Sonolus) Localize(text database.LocalizationText, locale string) string
func (*Sonolus) ParticleItems ¶
func (s *Sonolus) ParticleItems() []ParticleItemModel
func (*Sonolus) PlaylistItems ¶
func (s *Sonolus) PlaylistItems() []PlaylistItemModel
func (*Sonolus) PostItems ¶
func (s *Sonolus) PostItems() []PostItemModel
func (*Sonolus) ReplayItems ¶
func (s *Sonolus) ReplayItems() []ReplayItemModel
func (*Sonolus) RoomItems ¶
func (s *Sonolus) RoomItems() []RoomItemModel
func (*Sonolus) SkinItems ¶
func (s *Sonolus) SkinItems() []SkinItemModel
func (*Sonolus) UserItems ¶
func (s *Sonolus) UserItems() []UserItemModel
type SubmitCommunityActionHandler ¶
type SubmitCommunityActionHandler func(Context, string, FormValue) (coreserver.ServerSubmitItemCommunityActionResponse, *ServerError)
type SubmitCommunityCommentActionHandler ¶
type SubmitCommunityCommentActionHandler func(Context, string, string, FormValue) (coreserver.ServerSubmitItemCommunityCommentActionResponse, *ServerError)
type SubmitItemActionHandler ¶
type SubmitItemActionHandler func(Context, string, FormValue) (coreserver.ServerSubmitItemActionResponse, *ServerError)
type TextAreaOption ¶
type TextAreaOption = model.TextAreaOption
type TextOption ¶
type TextOption = model.TextOption
type ToggleOption ¶
type ToggleOption = model.ToggleOption
type UploadCommunityActionHandler ¶
type UploadCommunityActionHandler func(Context, string, string, []*UploadedFile) (coreserver.ServerUploadItemCommunityActionResponse, *ServerError)
type UploadCommunityCommentActionHandler ¶
type UploadCommunityCommentActionHandler func(Context, string, string, string, []*UploadedFile) (coreserver.ServerUploadItemCommunityCommentActionResponse, *ServerError)
type UploadItemActionHandler ¶
type UploadItemActionHandler func(Context, string, string, []*UploadedFile) (coreserver.ServerUploadItemActionResponse, *ServerError)
type UploadItemHandler ¶
type UploadItemHandler func(Context, string, []*UploadedFile) (coreserver.ServerUploadItemResponse, *ServerError)
type UploadOptions ¶
type UploadedFile ¶
type UserItemModel ¶
type UserItemModel = model.UserItemModel
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package model provides public data models, form parsing, option parsing, and item conversion helpers used by sonolus-server-go.
|
Package model provides public data models, form parsing, option parsing, and item conversion helpers used by sonolus-server-go. |
|
Package share provides Gin route installers for Sonolus web share behavior.
|
Package share provides Gin route installers for Sonolus web share behavior. |
Click to show internal directories.
Click to hide internal directories.