src

package
v0.0.0-...-01345e1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2022 License: AGPL-3.0, GPL-3.0 Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChannelTypes = struct {
	PUBLIC      string
	PRIVATE     string
	MULTIPLAYER string
	SPECTATOR   string
	TEMPORARY   string
	PM          string
	GROUP       string
}{"PUBLIC", "PRIVATE", "MULTIPLAYER", "SPECTATOR", "TEMPORARY", "PM", "GROUP"}
View Source
var ErrorCode = struct {
	ERR1 string
	ERR2 string
	ERR3 string
}{"ERR1_", "ERR2_", "ERR3_"}
View Source
var GameMode = struct {
	fruits string
	mania  string
	osu    string
	taiko  string
}{"fruits", "mania", "osu", "taiko"}

Functions

func AddHeaderDEV

func AddHeaderDEV(c echo.Context)

func ConnectMongo

func ConnectMongo(id string, pw string, driver string, url string) *mongo.Client

func CreateToken

func CreateToken()

func GenAccessToken

func GenAccessToken(username string) (Token string)

func GenRefreshToken

func GenRefreshToken(username string) (Token string)

func GetSql

func GetSql(path string) (query string)

func GetToken

func GetToken(db *sql.DB, c echo.Context) (code int, v interface{})

func ParseIntModeSQLFile

func ParseIntModeSQLFile(data int) (sqlFile string)

func ParseStringModeSQLFile

func ParseStringModeSQLFile(data string) (sqlFile string)

func QueryGetJsonArray

func QueryGetJsonArray(db *sql.DB, sql string, parm ...interface{}) interface{}

func QueryGetJsonObject

func QueryGetJsonObject(db *sql.DB, sql string, parm ...interface{}) interface{}

func QueryOnly

func QueryOnly(db *sql.DB, sql string, parm ...interface{}) error

func RefreshToken

func RefreshToken(db *sql.DB, token string)

Types

type Authentication

type Authentication struct {
	Authentication string `json:"authentication"`
}

type Bearer

type Bearer struct {
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type Beatmap

type Beatmap struct {
	Accuracy      float32   `json:"accuracy"`
	Ar            float32   `json:"ar"`
	BeatMapSetId  int       `json:"beatmapset_id"`
	Bpm           float32   `json:"bpm"`
	Convert       bool      `json:"convert"`
	CountCircles  int       `json:"count_circles"`
	CountSliders  int       `json:"count_sliders"`
	CountSpinners int       `json:"count_spinners"`
	Cs            float32   `json:"cs"`
	DeletedAt     Timestamp `json:"deleted_at"`
	Drain         float32   `json:"drain"`
	HitLength     int       `json:"hit_length"`
	IsScoreable   bool      `json:"is_scoreable"`
	LastUpdated   Timestamp `json:"last_updated"`
	ModeInt       int       `json:"mode_int"`
	PassCount     int       `json:"passcount"`
	PlayCount     int       `json:"playcount"`
	Ranked        int       `json:"ranked"`
	Status        string    `json:"status"`
	Url           string    `json:"url"`
}

type BeatmapCompact

type BeatmapCompact struct {
	DifficultyRating float32 `json:"difficulty_rating"`
	Id               int     `json:"id"`
	Mode             string  `json:"mode"`
	TotalLength      int     `json:"total_length"`
	Version          string  `json:"version"`
}

type Beatmapset

type Beatmapset struct {
	AvailabilityDownloadDisabled bool      `json:"availability.download_disabled"`
	AvailabilityMoreInformation  string    `json:"availability.more_information"`
	Bpm                          float32   `json:"bpm"`
	CanBeHyped                   bool      `json:"can_be_hyped"`
	Creator                      string    `json:"creator"`
	DiscussionEnabled            bool      `json:"discussion_enabled"`
	DiscussionLocked             bool      `json:"discussion_locked"`
	HypeCurrent                  int       `json:"hype.current"`
	HypeRequired                 int       `json:"hype.required"`
	IsScoreable                  bool      `json:"is_scoreable"`
	LastUpdated                  Timestamp `json:"last_updated"`
	LegacyThreadUrl              string    `json:"legacy_thread_url"`
	Nominationscurrent           int       `json:"nominations.current"`
	Nominationsrequired          int       `json:"nominations.required"`
	Ranked                       int       `json:"ranked"`
	RankedDate                   Timestamp `json:"ranked_date"`
	Source                       string    `json:"source"`
	Storyboard                   bool      `json:"storyboard"`
	SubmittedDate                Timestamp `json:"submitted_date"`
	Tags                         string    `json:"tags"`
}

type BeatmapsetCompact

type BeatmapsetCompact struct {
	Artist         string `json:"artist"`
	ArtistUnicode  string `json:"artist_unicode"`
	Covers         Covers `json:"covers"`
	Creator        string `json:"creator"`
	FavouriteCount int    `json:"favourite_count"`
	Id             int    `json:"id"`
	PlayCount      int    `json:"play_count"`
	PreviewUrl     string `json:"preview_url"`
	Source         string `json:"source"`
	Status         string `json:"status"`
	Title          string `json:"title"`
	TitleUnicode   string `json:"title_unicode"`
	UserId         int    `json:"user_id"`
	Video          bool   `json:"video"`
}

type BestPlay

type BestPlay []struct {
	Id         int        `json:"id"`
	BestId     int        `json:"best_id"`
	UserId     int        `json:"user_id"`
	Accuracy   float64    `json:"accuracy"`
	Mods       []string   `json:"mods"`
	Score      int        `json:"score"`
	MaxCombo   int        `json:"max_combo"`
	Perfect    bool       `json:"perfect"`
	Statistics Statistics `json:"statistics"`
	Pp         float64    `json:"pp"`
	Rank       string     `json:"rank"`
	CreatedAt  Timestamp  `json:"created_at"`
	Mode       string     `json:"mode"`
	ModeInt    int        `json:"mode_int"`
	Replay     bool       `json:"replay"`

	Beatmap    Beatmap           `json:"beatmap"`
	BeatmapSet BeatmapsetCompact `json:"beatmapset"`
	Weight     struct {
		Percentage float64 `json:"percentage"`
		Pp         float64 `json:"pp"`
	} `json:"weight"`
	User UserCompact `json:"user"`
}

type ChatChannel

type ChatChannel struct {
	ChannelId      int           `json:"channel_id"`
	Name           string        `json:"name"`
	Description    string        `json:"description"`
	Icon           string        `json:"icon"`
	Type           string        `json:"type"`
	FirstMessageId int           `json:"first_message_id"`
	LastReadId     int           `json:"last_read_id"`
	LastMessageId  int           `json:"last_message_id"`
	RecentMessages []ChatMessage `json:"recent_messages"`
	Moderated      bool          `json:"moderated"`
	Users          []int         `json:"users"`
}

type ChatMessage

type ChatMessage struct {
	MessageId int         `json:"message_id"`
	SenderId  int         `json:"sender_id"`
	ChannelId int         `json:"channel_id"`
	Timestamp string      `json:"timestamp"`
	Content   string      `json:"content"`
	IsAction  bool        `json:"is_action"`
	Sender    UserCompact `json:"sender"`
}

type Comment

type Comment struct {
	CommentableId   int    `json:"commentable_id"`
	CommentableType string `json:"commentable_type"`
	CreatedAt       string `json:"created_at"`
	DeletedAt       string `json:"deleted_at"`
	EditedAt        string `json:"edited_at"`
	EditedById      int    `json:"edited_by_id"`
	Id              int    `json:"id"`
	LegacyName      string `json:"legacy_name"`
	Message         string `json:"message"`
	MessageHtml     string `json:"message_html"`
	ParentId        int    `json:"parent_id"`
	Pinned          bool   `json:"pinned"`
	RepliesCount    int    `json:"replies_count"`
	UpdatedAt       string `json:"updated_at"`
	UserId          int    `json:"user_id"`
	VotesCount      int    `json:"votes_count"`
}

type CommentBundle

type CommentBundle struct {
	CommentableMeta  []CommentableMeta `json:"commentable_meta"`
	Comments         []Comment         `json:"comments"`
	HasMore          bool              `json:"has_more"`
	HasMoreId        int               `json:"has_more_id"`
	IncludedComments []Comment         `json:"included_comments"`
	PinnedComments   []Comment         `json:"pinned_comments"`
	Sort             string            `json:"sort"`
	TopLevelCount    int               `json:"top_level_count"`
	Total            int               `json:"total"`
	UserFollow       bool              `json:"user_follow"`
	UserVotes        []int             `json:"user_votes"`
	Users            []UserCompact     `json:"users"`
}

type CommentableMeta

type CommentableMeta struct {
	Id    int    `json:"id"`
	Title string `json:"title"`
	Type  string `json:"type"`
	Url   string `json:"url"`
}

type Covers

type Covers struct {
	Cover      string `json:"cover"`
	Cover2     string `json:"cover@2x"`
	Card       string `json:"card"`
	Card2      string `json:"card@2x"`
	List       string `json:"list"`
	List2      string `json:"list@2x"`
	SlimCover  string `json:"slimcover"`
	SlimCover2 string `json:"slimcover@2x"`
}

type Event

type Event struct {
	BeatMapPlayCount struct {
		CreatedAt Timestamp `json:"created_at"`
		Id        string    `json:"id"`
		Type      string    `json:"type"`

		Count   int `json:"count"`
		Beatmap struct {
			Title string `json:"title"`
			Url   string `json:"url"`
		} `json:"beatmap"`
	}
	BeatMapSetApprove struct {
		CreatedAt Timestamp `json:"created_at"`
		Id        string    `json:"id"`
		Type      string    `json:"type"`

		BeatmapSet struct {
			Title string `json:"title"`
			Url   string `json:"url"` // /b/num
		} `json:"beatmapset"`
		User struct {
			Username         string `json:"username"`
			Url              string `json:"url"`
			PreviousUsername string `json:"previousUsername"`
		} `json:"user"` // Beatmapset owner.
		// contains filtered or unexported fields
	}
	BeatMapSetDelete struct {
		CreatedAt  Timestamp `json:"created_at"`
		Id         string    `json:"id"`
		Type       string    `json:"type"`
		BeatmapSet struct {
			Title string `json:"title"`
			Url   string `json:"url"`
		} `json:"beatmapset"`
	}
	BeatMapSetRevive struct {
		CreatedAt  Timestamp `json:"created_at"`
		Id         string    `json:"id"`
		Type       string    `json:"type"`
		BeatmapSet struct {
			Title string `json:"title"`
			Url   string `json:"url"` // /b/num
		} `json:"beatmapset"`
		User struct {
			Username         string `json:"username"`
			Url              string `json:"url"`
			PreviousUsername string `json:"previousUsername"`
		} `json:"user"` // Beatmapset owner.
	}
	BeatMapSetUpdate struct {
		CreatedAt  Timestamp `json:"created_at"`
		Id         string    `json:"id"`
		Type       string    `json:"type"`
		BeatmapSet struct {
			Title string `json:"title"`
			Url   string `json:"url"` // /b/num
		} `json:"beatmapset"`
		User struct {
			Username         string `json:"username"`
			Url              string `json:"url"`
			PreviousUsername string `json:"previousUsername"`
		} `json:"user"` // Beatmapset owner.
	}
	BeatMapSetUpload struct {
		CreatedAt  Timestamp `json:"created_at"`
		Id         string    `json:"id"`
		Type       string    `json:"type"`
		BeatmapSet struct {
			Title string `json:"title"`
			Url   string `json:"url"` // /b/num
		} `json:"beatmapset"`
		User struct {
			Username         string `json:"username"`
			Url              string `json:"url"`
			PreviousUsername string `json:"previousUsername"`
		} `json:"user"` // Beatmapset owner.
	}
	// contains filtered or unexported fields
}

type FailAuthentication

type FailAuthentication struct {
	Error string `json:"error"`
}

type Group

type Group struct {
	Id             int    `json:"id"`
	Identifier     string `json:"identifier"`
	IsProbationary string `json:"is_probationary"`
	HasPlayModes   bool   `json:"has_playmodes"`
	Name           string `json:"name"`
	ShortName      string `json:"short_name"`
	Description    string `json:"description"`
	Colour         string `json:"colour"`
}

type MostPlayed

type MostPlayed []struct {
	BeatmapId  int               `json:"beatmap_id"`
	Count      int               `json:"count"`
	Beatmap    BeatmapCompact    `json:"beatmap"`
	BeatmapSet BeatmapsetCompact `json:"beatmapset"`
}

type Oauth

type Oauth struct {
	Userid       int    `json:"userId"`
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
	CreateTime   string `json:"cteateTime"`
	LifeTime     string `json:"lifeTime"`
	Active       int    `json:"active"`
}

func CheckTokenAlive

func CheckTokenAlive(db *sql.DB, token string) ([]Oauth, bool)

type RecentActivity

type RecentActivity []struct {
	Created_at *string `json:"created_at"`
	CreatedAt  *string `json:"createdAt"`
	Id         int     `json:"id"`
	Type       *string `json:"type"`
	ScoreRank  *string `json:"scoreRank"`
	Rank       int     `json:"rank"`
	Mode       *string `json:"mode"`
	// contains filtered or unexported fields
}

type ScoresBest

type ScoresBest []struct {
	Id         int      `json:"id"`
	BestId     int      `json:"best_id"`
	UserId     int      `json:"user_id"`
	Accuracy   float64  `json:"accuracy"`
	Mods       []string `json:"mods"`
	Score      int      `json:"score"`
	MaxCombo   int      `json:"max_combo"`
	Perfect    bool     `json:"perfect"`
	Statistics struct {
		Count50   int `json:"count_50"`
		Count100  int `json:"count_100"`
		Count300  int `json:"count_300"`
		CountGeki int `json:"count_geki"`
		CountKatu int `json:"count_katu"`
		CountMiss int `json:"count_miss"`
	} `json:"statistics"`
	Pp        float32 `json:"pp"`
	CreatedAt *string `json:"created_at"`
	Mode      *string `json:"mode"`
	ModeInt   int     `json:"mode_int"`
	Replay    bool    `json:"replay"`
	Beatmap   struct {
		DifficultyRating float32 `json:"difficulty_rating"`
		Id               int     `json:"id"`
		Mode             *string `json:"mode"`
		TotalLength      int     `json:"total_length"`
		Version          *string `json:"version"`
		Accuracy         float32 `json:"accuracy"`
		Ar               float32 `json:"ar"`
		BeatmapsetId     int     `json:"beatmapset_id"`
		Bpm              int     `json:"bpm"`
		Convert          bool    `json:"convert"`
		CountCircles     bool    `json:"count_circles"`
		CountSliders     bool    `json:"count_sliders"`
		CountSpinners    bool    `json:"count_spinners"`
		Cs               float32 `json:"cs"`
		DeletedAt        *string `json:"deleted_at"`
		Drain            float32 `json:"drain"`
		HitLength        int     `json:"hit_length"`
		IsScoreable      bool    `json:"is_scoreable"`
		LastUpdated      *string `json:"last_updated"`
		ModeInt          int     `json:"mode_int"`
		Passcount        int     `json:"passcount"`
		Playcount        int     `json:"playcount"`
		Ranked           int     `json:"ranked"`
		Status           *string `json:"status"`
		Url              *string `json:"url"`
	} `json:"Beatmap"`
	Beatmapset struct {
		Artist        *string `json:"artist"`
		ArtistUnicode *string `json:"artist_unicode"`
		Covers        struct {
			Cover       *string `json:"cover"`
			Cover2x     *string `json:"cover@2x"`
			Card        *string `json:"card"`
			Card2x      *string `json:"card@2x"`
			List        *string `json:"list"`
			List2x      *string `json:"list@2x"`
			SlimCover   *string `json:"artist_unicode"`
			SlimCover2x *string `json:"artist_unicode@2x"`
		} `json:"covers"`
		Creator        *string `json:"creator"`
		FavouriteCount int     `json:"favourite_count"`
		Hype           *string `json:"hype"`
		Id             int     `json:"id"`
		PlayCount      int     `json:"play_count"`
		PreviewUrl     *string `json:"preview_url"`
		Source         *string `json:"source"`
		Status         *string `json:"status"`
		Title          *string `json:"title"`
		TitleUnicode   *string `json:"title_unicode"`
		UserId         *string `json:"user_id"`
		Video          *string `json:"video"`
	} `json:"beatmapset"`
	Weight struct {
		Percentage float32 `json:"percentage"`
		Pp         int     `json:"pp"`
	} `json:"weight"`
	User struct {
		AvatarUrl     *string `json:"avatar_url"`
		CountryCode   *string `json:"country_code"`
		DefaultGroup  *string `json:"default_group"`
		Id            int     `json:"id"`
		IsActive      bool    `json:"is_active"`
		IsBot         bool    `json:"is_bot"`
		IsOnline      bool    `json:"is_online"`
		IsSupporter   bool    `json:"is_supporter"`
		LastVisit     *string `json:"last_visit"`
		PmFriendsOnly bool    `json:"pm_friends_only"`
		ProfileColour *string `json:"profile_colour"`
		Username      *string `json:"username"`
	} `json:"user"`
}

type Statistics

type Statistics struct {
	Count50   int `json:"count_50"`
	Count100  int `json:"count_100"`
	Count300  int `json:"count_300"`
	CountGeki int `json:"count_geki"`
	CountKatu int `json:"count_katu"`
	CountMiss int `json:"count_miss"`
}

type Timestamp

type Timestamp string

type User

type User struct {
	AvatarUrl     *string `json:"avatar_url"`
	CountryCode   *string `json:"country_code"`
	DefaultGroup  *string `json:"default_group"`
	Id            int     `json:"id"`
	IsActive      bool    `json:"is_active"`
	IsBot         bool    `json:"is_bot"`
	IsOnline      bool    `json:"is_online"`
	IsSupporter   bool    `json:"is_supporter"`
	LastVisit     *string `json:"last_visit"`
	PmFriendsOnly bool    `json:"pm_friends_only"`
	ProfileColour *string `json:"profile_colour"`
	Username      *string `json:"username"`
	CoverUrl      *string `json:"cover_url"`
	Discord       *string `json:"discord"`
	HasSupported  bool    `json:"has_supported"`
	Interests     *string `json:"interests"`
	JoinDate      *string `json:"join_date"`
	Kudosu        struct {
		Total     int `json:"total"`
		Available int `json:"available"`
	} `json:"kudosu"`
	Location     *string  `json:"location"`
	MaxBlocks    int      `json:"max_blocks"`
	MaxFriends   int      `json:"max_friends"`
	Occupation   *string  `json:"occupation"`
	PlayMode     *string  `json:"playmode"`
	PlayStyle    []string `json:"playstyle"`
	PostCount    int      `json:"post_count"`
	ProfileOrder []string `json:"profile_order"`
	Skype        *string  `json:"skype"`
	Title        *string  `json:"title"`
	TitleUrl     *string  `json:"title_url"`
	Twitter      *string  `json:"twitter"`
	Website      *string  `json:"website"`
	Country      struct {
		Code *string `json:"code"`
		Name *string `json:"name"`
	} `json:"country"`
	Cover struct {
		CustomUrl string `json:"custom_url"`
		Url       string `json:"url"`
		Id        string `json:"id"`
	} `json:"cover"`

	AccountHistory []struct {
		Id        int     `json:"id"`
		Type      *string `json:"type"`
		Timestamp *string `json:"timestamp"`
		Length    int     `json:"length"`
	} `json:"account_history"`
	ActiveTournamentBanner []struct {
		Id           int     `json:"id"`
		TournamentId int     `json:"tournament_id"`
		Image        *string `json:"image"`
	} `json:"active_tournament_banner"`
	Badges []struct {
		AwardedAt   *string `json:"awarded_at"`
		Description *string `json:"description"`
		ImageUrl    *string `json:"image_url"`
		Url         *string `json:"url"`
	} `json:"badges"`
	BeatmapPlaycountsCount   int `json:"beatmap_playcounts_count"`
	FavouriteBeatmapsetCount int `json:"favourite_beatmapset_count"`
	FollowerCount            int `json:"follower_count"`
	GraveyardBeatmapsetCount int `json:"graveyard_beatmapset_count"`
	Groups                   []struct {
		Id             *string `json:"id"`
		Identifier     *string `json:"identifier"`
		IsProbationary *string `json:"is_probationary"`
		Name           *string `json:"name"`
		ShortName      *string `json:"short_name"`
		Description    *string `json:"description"`
		Colour         *string `json:"colour"`
		Playmodes      *string `json:"playmodes"`
	} `json:"groups"`
	LovedBeatmapsetCount int `json:"loved_beatmapset_count"`

	MonthlyPlaycounts []struct {
		StartDate *string `json:"start_date"`
		Count     int     `json:"count"`
	} `json:"monthly_playcounts"`
	Page struct {
		Html string `json:"html"`
		Raw  string `json:"raw"`
	} `json:"page"`
	PreviousUsernames                []string `json:"previous_usernames"`
	RankedAndApprovedBeatmapsetCount int      `json:"ranked_and_approved_beatmapset_count"`
	ReplaysWatchedCounts             []struct {
		StartDate *string `json:"start_date"`
		Count     int     `json:"count"`
	} `json:"replays_watched_counts"`
	ScoresBestCount   int `json:"scores_best_count"`
	ScoresFirstCount  int `json:"scores_first_count"`
	ScoresRecentCount int `json:"scores_recent_count"`

	Statistics struct {
		Level struct {
			Current  int `json:"current"`
			Progress int `json:"progress"`
		} `json:"level"`

		Pp                     float64 `json:"pp"`
		PpRank                 int     `json:"pp_rank"`
		RankedScore            int64   `json:"ranked_score"`
		HitAccuracy            float64 `json:"hit_accuracy"`
		PlayCount              int     `json:"play_count"`
		PlayTime               int     `json:"play_time"`
		TotalScore             int64   `json:"total_score"`
		TotalHits              int64   `json:"total_hits"`
		MaximumCombo           int     `json:"maximum_combo"`
		ReplaysWatchedByOthers int     `json:"replays_watched_by_others"`
		IsRanked               bool    `json:"is_ranked"`
		GradeCounts            struct {
			Ss  int `json:"ss"`
			Ssh int `json:"ssh"`
			S   int `json:"s"`
			Sh  int `json:"sh"`
			A   int `json:"a"`
		} `json:"grade_counts"`
		Rank struct {
			Global  int `json:"global"`
			Country int `json:"country"`
		} `json:"rank"`
	} `json:"statistics"`
	SupportLevel            int `json:"support_level"`
	UnrankedBeatmapsetCount int `json:"unranked_beatmapset_count"`
	UserAchievements        []struct {
		AchievedAt    string `json:"achieved_at"`
		AchievementId int    `json:"achievement_id"`
	} `json:"user_achievements"`
	RankHistory struct {
		Mode *string `json:"mode"`
		Data []int   `json:"data"`
	} `json:"rankHistory"`
	RankHistory_ struct {
		Mode *string `json:"mode"`
		Data []int   `json:"data"`
	} `json:"rank_history"`
}

type UserCompact

type UserCompact struct {
	AvatarUrl     string    `json:"avatar_url"`      //url of user's avatar
	CountryCode   string    `json:"country_code"`    //two-letter code representing user's country
	DefaultGroup  string    `json:"default_group"`   //Identifier of the default Group the user belongs to.
	Id            int       `json:"id"`              //unique identifier for user
	IsActive      bool      `json:"is_active"`       //has this account been active in the last x months?
	IsBot         bool      `json:"is_bot"`          //is this a bot account?
	IsOnline      bool      `json:"is_online"`       //is the user currently online? (either on lazer or the new website)
	IsSupporter   bool      `json:"is_supporter"`    //does this user have supporter?
	LastVisit     Timestamp `json:"last_visit"`      //last access time. null if the user hides online presence
	PmFriendsOnly bool      `json:"pm_friends_only"` //whether or not the user allows PM from other than friends
	ProfileColour string    `json:"profile_colour"`  //colour of username/profile highlight, hex code (e.g. #333333)
	Username      string    `json:"username"`        //user's display name
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL