Documentation
¶
Index ¶
- Constants
- Variables
- func GetDevAPIHandler() http.Handler
- func RenderMarkdown(src []byte, opt ...*Option) (out []byte)
- type API
- type Cond
- type DependMap
- type ErrResp
- type GToken
- type MySqlAPI
- func (api *MySqlAPI) GetPluginCounts(opt PluginListOpt) (count PluginCounts, err error)
- func (api *MySqlAPI) GetPluginInfo(id string) (info *PluginInfo, err error)
- func (api *MySqlAPI) GetPluginList(opt PluginListOpt) (infos []*PluginInfo, err error)
- func (api *MySqlAPI) GetPluginReadme(id string) (data []byte, prefix string, err error)
- func (api *MySqlAPI) GetPluginRelease(id string, tag Version) (release *PluginRelease, err error)
- func (api *MySqlAPI) GetPluginReleaseAsset(id string, tag Version, filename string) (rc io.ReadSeekCloser, modTime time.Time, err error)
- func (api *MySqlAPI) GetPluginReleases(id string) (releases []*PluginRelease, err error)
- func (api *MySqlAPI) QueryContext(ctx context.Context, cmd string, args ...any) (rows *sql.Rows, err error)
- type NopReadSeeker
- type Option
- type PluginCounts
- type PluginInfo
- type PluginLabels
- type PluginListOpt
- type PluginRelease
- type StatusCodeErr
- type Version
- type VersionCond
Constants ¶
View Source
const DevApiVerion = 0
Variables ¶
View Source
var ( BASE_DIR string = "/opt/pwebpoint" PLUGIN_DIR string = filepath.Join(BASE_DIR, "plugin") CACHE_DIR string = filepath.Join(BASE_DIR, "caches") PLUGIN_CACHE_DIR string = filepath.Join(CACHE_DIR, "plugin") )
View Source
var ( PluginIdRe = regexp.MustCompile("[0-9a-z_]{1,64}") VersionRe = regexp.MustCompile(`^[-+0-9A-Za-z*]+(?:\.[-+0-9A-Za-z*]+)*`) )
View Source
var DEBUG = os.Getenv("DEBUG") == "true"
View Source
var (
ErrNotFound = errors.New("ErrNotFound")
)
View Source
var VersionMatchAny = VersionCond{ Cond: EQ, Major: -1, Minor: -1, Patch: -1, }
Functions ¶
func GetDevAPIHandler ¶
func RenderMarkdown ¶ added in v0.6.0
Types ¶
type API ¶
type API interface {
GetPluginCounts(opt PluginListOpt) (count PluginCounts, err error)
GetPluginList(opt PluginListOpt) (infos []*PluginInfo, err error)
GetPluginInfo(id string) (info *PluginInfo, err error)
GetPluginReadme(id string) (data []byte, prefix string, err error)
GetPluginReleases(id string) (releases []*PluginRelease, err error)
GetPluginRelease(id string, tag Version) (release *PluginRelease, err error)
GetPluginReleaseAsset(id string, tag Version, filename string) (rc io.ReadSeekCloser, modTime time.Time, err error)
}
type DependMap ¶
type DependMap map[string]VersionCond
type ErrResp ¶ added in v0.5.0
type ErrResp struct {
Status string `json:"status"`
Name string `json:"error"`
Msg string `json:"message"`
}
func NewErrResp ¶ added in v0.5.0
type GToken ¶ added in v0.6.1
type MySqlAPI ¶
func NewMySqlAPI ¶
func (*MySqlAPI) GetPluginCounts ¶
func (api *MySqlAPI) GetPluginCounts(opt PluginListOpt) (count PluginCounts, err error)
func (*MySqlAPI) GetPluginInfo ¶
func (api *MySqlAPI) GetPluginInfo(id string) (info *PluginInfo, err error)
func (*MySqlAPI) GetPluginList ¶
func (api *MySqlAPI) GetPluginList(opt PluginListOpt) (infos []*PluginInfo, err error)
func (*MySqlAPI) GetPluginReadme ¶ added in v0.6.0
func (*MySqlAPI) GetPluginRelease ¶
func (api *MySqlAPI) GetPluginRelease(id string, tag Version) (release *PluginRelease, err error)
func (*MySqlAPI) GetPluginReleaseAsset ¶
func (*MySqlAPI) GetPluginReleases ¶
func (api *MySqlAPI) GetPluginReleases(id string) (releases []*PluginRelease, err error)
type NopReadSeeker ¶
type NopReadSeeker struct {
io.ReadSeeker
}
func (NopReadSeeker) Close ¶
func (NopReadSeeker) Close() error
type Option ¶ added in v0.6.0
func (*Option) SetHtmlOptions ¶ added in v0.6.0
func (o *Option) SetHtmlOptions(opt *html.RendererOptions)
type PluginCounts ¶
type PluginInfo ¶
type PluginInfo struct {
Id string `json:"id"`
Name string `json:"name"`
Version Version `json:"version"`
Authors []string `json:"authors"`
Desc string `json:"desc,omitempty"`
Desc_zhCN string `json:"desc_zhCN,omitempty"`
CreateAt time.Time `json:"createAt"`
LastUpdate time.Time `json:"lastUpdate"`
Repo string `json:"repo,omitempty"`
RepoBranch string `json:"repoBranch,omitempty"`
RepoSubdir string `json:"repoSubdir,omitempty"`
Link string `json:"link,omitempty"`
Labels PluginLabels `json:"labels"`
Downloads int64 `json:"downloads"`
Dependencies DependMap `json:"dependencies,omitempty"`
GithubSync bool `json:"github_sync"`
GhRepoOwner string `json:"ghRepoOwner,omitempty"`
GhRepoName string `json:"ghRepoName,omitempty"`
LastSync *time.Time `json:"last_sync,omitempty"`
}
type PluginLabels ¶
type PluginListOpt ¶
type PluginRelease ¶
type PluginRelease struct {
Id string `json:"id"`
Tag Version `json:"tag"`
Enabled bool `json:"enabled"`
Stable bool `json:"stable"`
Size int64 `json:"size"`
Uploaded time.Time `json:"uploaded"`
FileName string `json:"filename"`
Downloads int `json:"downloads"`
GithubUrl string `json:"github_url"`
}
type StatusCodeErr ¶
type StatusCodeErr struct {
Code int
}
func (*StatusCodeErr) Error ¶
func (e *StatusCodeErr) Error() string
type Version ¶
func VersionFromString ¶
func (Version) MarshalJSON ¶
func (*Version) UnmarshalJSON ¶
type VersionCond ¶
func VersionCondFromString ¶
func VersionCondFromString(s string) (v VersionCond, err error)
func (VersionCond) IsMatch ¶
func (vc VersionCond) IsMatch(v Version) bool
func (VersionCond) MarshalJSON ¶
func (v VersionCond) MarshalJSON() ([]byte, error)
func (*VersionCond) Scan ¶
func (v *VersionCond) Scan(d any) (err error)
func (VersionCond) String ¶
func (v VersionCond) String() (s string)
func (*VersionCond) UnmarshalJSON ¶
func (v *VersionCond) UnmarshalJSON(data []byte) (err error)
Click to show internal directories.
Click to hide internal directories.