2024-05-31 09:54:39 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql/driver"
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
2024-09-12 14:57:53 +00:00
|
|
|
// TODO: Decide whether to turn this into an int too to save resources
|
|
|
|
// And then use go:generate instead for pretty printing
|
|
|
|
|
2024-06-06 11:54:50 +00:00
|
|
|
// What software a server is running
|
2024-05-31 09:54:39 +00:00
|
|
|
// Mostly important for rendering
|
|
|
|
type RemoteServerType string
|
|
|
|
|
|
|
|
const (
|
|
|
|
// Includes forks like glitch-soc, etc
|
|
|
|
REMOTE_SERVER_MASTODON = RemoteServerType("Mastodon")
|
|
|
|
// Includes forks like Ice Shrimp, Sharkey, Cutiekey, etc
|
|
|
|
REMOTE_SERVER_MISSKEY = RemoteServerType("Misskey")
|
|
|
|
// Includes Akkoma
|
|
|
|
REMOTE_SERVER_PLEMORA = RemoteServerType("Plemora")
|
|
|
|
// And of course, yours truly
|
|
|
|
REMOTE_SERVER_LINSTROM = RemoteServerType("Linstrom")
|
|
|
|
)
|
|
|
|
|
|
|
|
func (r *RemoteServerType) Value() (driver.Value, error) {
|
|
|
|
return r, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *RemoteServerType) Scan(raw any) error {
|
|
|
|
if v, ok := raw.(string); ok {
|
|
|
|
*r = RemoteServerType(v)
|
|
|
|
return nil
|
|
|
|
} else {
|
|
|
|
return errors.New("value not a string")
|
|
|
|
}
|
|
|
|
}
|