This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
summer-utils/tables/web/api-route.go
2023-04-16 11:56:17 +01:00

35 lines
863 B
Go

package web
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
"net/http"
)
type ApiRoute struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
DomainId uint64 `json:"domain_id"`
Version uint64 `json:"version"`
Route string `json:"route"`
Dst string `json:"dst"`
SecureMode *bool `json:"secure_mode,omitempty"`
IgnoreCert *bool `json:"ignore_cert,omitempty"`
Enabled *bool `json:"enabled"`
}
func (a ApiRoute) GetId() uint64 { return a.Id }
func (a ApiRoute) SetEnabled(v bool) ApiRoute {
a.Enabled = utils.PBool(v)
return a
}
func (a ApiRoute) ClearForNew() ApiRoute {
a.Id = 0
return a
}
func (a ApiRoute) IsSecureMode() bool { return utils.SBool(a.SecureMode) }
func (a ApiRoute) IsIgnoreCert() bool { return utils.SBool(a.IgnoreCert) }
func (a ApiRoute) UpdateHeaders(_ http.Header) {} // purposefully a stub