Documentation
¶
Index ¶
- Variables
- func Accept(r *http.Request, format string) bool
- func AddToKnownHosts(user, server string) error
- func AppendUsingReflect(slice any, value any) any
- func AuthenticateTailscale(authkey string) error
- func BackupDir(path string, encKey string, outfile string) error
- func Bit(b byte, i int) bool
- func CallMethod(v any, m string, args []string) ([]string, error)
- func ClientIP(r *http.Request) string
- func CmdlineServer(h http.Handler)
- func CompressDir(dir, outFile string) error
- func ContentType(r *http.Request, format string) bool
- func Cookie(r *http.Request, id string) string
- func CopyDir(srcDir, dstDir string) error
- func CopyFile(src, dst string) error
- func CopyFileFromRemote(user, addr, src, dst string) ([]byte, error)
- func CopyFileToRemote(user, addr, src, dst string) ([]byte, error)
- func CreateFile(path string) (*os.File, error)
- func CreateP(name string) (*os.File, error)
- func DecryptAndDecompressDir(src io.Reader, dst string, key string) error
- func DeleteCookie(w http.ResponseWriter, name string)
- func Download(url, target string) error
- func DownloadDir(user, host, path string) ([]byte, error)
- func Drill(v any, path []string) (any, error)
- func EncryptAndCompressDir(src string, buf io.Writer, key string) error
- func EncryptedReader(key string, r io.Reader) (*cipher.StreamReader, error)
- func EncryptedWriter(key string, w io.Writer) (*cipher.StreamWriter, error)
- func EnvVar(name string, def string) string
- func ErrorHTTP(w http.ResponseWriter, code int)
- func ExecRemote(user, host, cmd string) ([]byte, error)
- func Exists(path string) bool
- func FReadJSONFile(fsys fs.FS, path string, v any) error
- func FieldValue(v any, f string) any
- func FilterString(input, charset string) string
- func FilterTestFiles(fi fs.FileInfo) bool
- func Flatten(v any) map[string]string
- func FprintJSON(w io.Writer, v any) (int, error)
- func FrequencyToRGB(frequency float64) string
- func GetAddr() string
- func GetInstalledGoVersion() (string, error)
- func GetLatestGoVersion() (string, error)
- func GetName(v any) string
- func GetOSID() (string, error)
- func GetPasswordFromStdin(prompt string) (string, error)
- func HandleCORS(w http.ResponseWriter, r *http.Request)
- func HandlePUT(w http.ResponseWriter, r *http.Request, v any)
- func HasMethod(v any, m string) bool
- func HomeDir() string
- func InstallGo() error
- func InstallNode() error
- func InstallTailscale() error
- func IntToID(v int64) string
- func IsAlphaNumeric(ch rune) bool
- func IsArray(v any) bool
- func IsBool(v any) bool
- func IsDir(path string) bool
- func IsInt(v any) bool
- func IsLoopbackIP(ip net.IP) bool
- func IsMap(v any) bool
- func IsMutation(r *http.Request) bool
- func IsPrivateIP(ip net.IP) bool
- func IsPublicIP(ip net.IP) bool
- func IsRootRequest(r *http.Request) bool
- func IsStdlib(pkg string) bool
- func IsString(v any) bool
- func IsStruct(v any) bool
- func IsTenDigits(phone string) bool
- func JSONString(v any) string
- func JoinPath(path []string) string
- func KebabCase(s string) string
- func Kind(v interface{}) string
- func LatestGoVersion() string
- func ListenAndServe(h http.Handler) error
- func MIMEType(file string) string
- func Main(s http.Handler)
- func Must[T any](v T, err error) T
- func NewRecursiveWatcher(dir string) (*fsnotify.Watcher, error)
- func NewReverseProxy(backendURL string) *httputil.ReverseProxy
- func NewServeMux(handlers map[string]http.Handler) http.Handler
- func NormalizeGoName(s string) string
- func NormalizePhoneNumber(number string) string
- func OS() string
- func OnFileChange(path string, callback func()) error
- func OnlyLowerCase(s string) string
- func OnlyOne[T any](m map[string]T) (id string, value T, ok bool)
- func OptionallyServeHTTP(v any, w http.ResponseWriter, r *http.Request)
- func PackageManager() string
- func ParseJSON[T any](s string) T
- func ParsePath(s string) []string
- func PascalCase(s string) string
- func PasswordProtected(passwd string, h http.Handler) http.Handler
- func Pop[T any](items []T) (T, []T)
- func PopPath(path string) (first string, rest string, isRoot bool)
- func Port() string
- func PrintJSON(v any) (int, error)
- func PrintResponse(resp *http.Response)
- func QuadrupleTime(fn1, fn2, fn3, fn4 func()) error
- func RandomBits(n int) []bool
- func RandomBytes(n int) []byte
- func RandomCode(digits int) string
- func RandomDigit() int
- func RandomElement[T any](arr []T) (T, error)
- func RandomID() string
- func RandomString(length int, charset string) string
- func RandomToken(bytes int) string
- func ReadDir(path string) ([]string, error)
- func ReadGoPackageFromDisk(dir string) (*ast.Package, error)
- func ReadJSON[T any](r io.Reader) *T
- func ReadJSONFS(w io.Writer, t *Type, path string) error
- func ReadJSONFile(path string, v any) error
- func ReadRemoteFile(user, password, host string, port int, remotePath string) (string, error)
- func ReloadSystemd() error
- func RenderTemplateToFile(tmpl string, path string, in any) error
- func RequireEnvVar(name string) string
- func RestoreDir(backupFile string, encKey string, outDir string) error
- func Run(cmd *exec.Cmd) error
- func RunInParallel(fns []func() error) []error
- func RunSSHCommandWithKnownHostsCheck(host, user, cmd string, auth []ssh.AuthMethod) ([]byte, error)
- func SHA256(b []byte) []byte
- func SSHClientConfig(user string) (*ssh.ClientConfig, error)
- func SecurePassword() string
- func Serialize(v any) []byte
- func Serve(s http.Handler)
- func ServeAll(handlers map[string]http.Handler) error
- func ServeAny(v any, w http.ResponseWriter, r *http.Request)
- func ServeBool(path []string, v any, w http.ResponseWriter, r *http.Request)
- func ServeError(w http.ResponseWriter, code int)
- func ServeHTTPS(h http.Handler, email, certDir string, allowHost func(host string) bool) error
- func ServeMethod(m string, v any, w http.ResponseWriter, r *http.Request)
- func ServeMyIP(w http.ResponseWriter, r *http.Request)
- func ServeObject(path []string, v Object, w http.ResponseWriter, r *http.Request)
- func SetField(v any, fieldName string, fieldValue any)
- func SnakeCase(s string) string
- func SortedKeys[T any](m map[string]T) []string
- func StartServer(s http.Handler) error
- func StripNonAlphaNumeric(s string) string
- func StructToMap(val any) map[string]any
- func SubFS(fsys fs.FS, dir string) fs.FS
- func Sync(src, dst string) error
- func TitleCase(s string) string
- func Touch(path string) error
- func UnixNanoTimestamp() string
- func UnixTimestamp() string
- func UploadDir(user, host string, b []byte, path string) error
- func UserPassServer(user string, pass string, h http.Handler) http.Handler
- func WaitUntil(h, m, s int)
- func Watch(path string, fn func()) error
- func WavelengthToRGB(wavelength float64) string
- func WriteFile(path string, b []byte) error
- func WriteJSON(w http.ResponseWriter, v any)
- func WriteJSONFS(path string, b []byte) error
- func WriteJSONFile(path string, v any) error
- func WriteMethodNotAllowed(w http.ResponseWriter)
- func WriteNotFound(w http.ResponseWriter)
- func WriteTempFile(b []byte) (string, error)
- type API
- func (api *API[T]) Data() *Table[T]
- func (api *API[T]) Login(w http.ResponseWriter, r *http.Request)
- func (api *API[T]) Logout(w http.ResponseWriter, r *http.Request)
- func (api *API[T]) NewOrg(w http.ResponseWriter, r *http.Request)
- func (api *API[T]) Orgs() *Table[Org]
- func (api *API[T]) Register(w http.ResponseWriter, r *http.Request)
- func (api *API[T]) ServeData(w http.ResponseWriter, r *http.Request)
- func (api *API[T]) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (api *API[T]) Sessions() *Table[string]
- func (api *API[T]) Users() *Table[User]
- type Account
- type Action
- type App
- type AppConfig
- type AppServer
- type Array
- type ArrayType
- type AuthMethod
- type Backend
- type BlogPost
- type Bool
- type BuildConfig
- type BuildServer
- type CI
- type Cafe
- type CmdServer
- type Collection
- type DB
- func (db *DB) AddColumn(table, column, typ string) error
- func (db *DB) CreateTable(name string) error
- func (db *DB) Delete(name string) error
- func (db *DB) Insert(name string) error
- func (db *DB) SelectMany(name string) error
- func (db *DB) SelectOne(name string) error
- func (db *DB) Update(name string) error
- type DevServer
- type Email
- type Endpoint
- type Error
- type Expression
- type FancyRoute
- type FancyRouter
- type Field
- type File
- type FileObject
- type FileServer
- type FileStore
- type FileSystem
- type Folder
- type Form
- type Function
- type GitRepo
- type GithubMirror
- type GithubRepository
- type GithubWebhook
- type GithubWebhookRequest
- type GoBuilder
- type GoCodebase
- type GoDecl
- type GoFile
- type GoPackage
- type GoWorkspace
- type HCloudStorageFileSystem
- type HTMLDocument
- type HTMLHead
- type HTMLReader
- type HTMLTemplateData
- type HashCache
- type ImportMap
- type Int
- type JSONFileServer
- type Link
- type LinkList
- type List
- type ListItem
- type LiveObject
- type LocalFileSystem
- func (fs *LocalFileSystem) Dig(path string) FileSystem
- func (fs *LocalFileSystem) IsDir(path string) bool
- func (fs *LocalFileSystem) IsFile(path string) bool
- func (fs *LocalFileSystem) MakeDir(path string) error
- func (fs *LocalFileSystem) ReadDir(path string) ([]string, error)
- func (fs *LocalFileSystem) ReadFile(path string) ([]byte, error)
- func (fs *LocalFileSystem) Remove(path string) error
- func (fs *LocalFileSystem) WriteFile(path string, b []byte) error
- type Map
- type MapList
- type MapType
- type Metadata
- type MethodCall
- type Movie
- type MultiHostServer
- type MultiUserAuthHandler
- type Name
- type NextApp
- type NextPage
- type Nil
- type Object
- type Org
- type Pair
- type Person
- type Personal
- type PhoneNumber
- type PingServer
- type PostgresDB
- type ProgrammingLanguage
- type Prompt
- type PromptOption
- type ReactComponent
- type ReactElement
- type ReactHook
- type Ref
- type RemoteFileSystem
- func (fs *RemoteFileSystem) IsDir(path string) bool
- func (fs *RemoteFileSystem) IsFile(path string) bool
- func (fs *RemoteFileSystem) MakeDir(path string) error
- func (fs *RemoteFileSystem) ReadDir(path string) ([]string, error)
- func (fs *RemoteFileSystem) ReadFile(path string) ([]byte, error)
- func (fs *RemoteFileSystem) Remove(path string) error
- func (fs *RemoteFileSystem) WriteFile(path string, b []byte) error
- type Request
- type Response
- type Route
- type Router
- type SHA256Server
- type ScalarType
- type Schema
- type SchemaCafe
- type Sender
- type Service
- type Session
- type Set
- type SheetsDB
- type SimpleForm
- type SinglePageApp
- type SingleUserApp
- func (a *SingleUserApp) AuthFiles() FileSystem
- func (a *SingleUserApp) AuthHandler() *SingleUserAuthHandler
- func (a *SingleUserApp) Authorized(r *http.Request) (bool, error)
- func (a *SingleUserApp) GetSession(token string) (*Session, error)
- func (app *SingleUserApp) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type SingleUserAuthHandler
- type Statement
- type StreamBroadcaster
- type StreamMultiplexer
- type String
- type Struct
- type StructType
- type SystemdService
- type TVEpisode
- type TVSeason
- type TVShow
- type Table
- func (t *Table[T]) Delete(id string) error
- func (t *Table[T]) FindIDsBy(k, v string) (Set[string], error)
- func (t *Table[T]) Get(id string) (*T, error)
- func (t *Table[T]) Len() int
- func (t *Table[T]) ListAll() []string
- func (t *Table[T]) Post(v *T) error
- func (t *Table[T]) Set(id string, v *T) error
- type TableConstraint
- type TemplateServer
- type TwilioClient
- type Type
- type User
- type Value
- func (v *Value) GoImports() map[string]bool
- func (v *Value) GoString(imports map[string]string) string
- func (v *Value) WriteGoConstFile(path string) error
- func (v *Value) WriteGoVarFile(path string) error
- func (v *Value) WriteReactHookFile(path string) error
- func (v *Value) WriteTypeScriptConstantFile(path string) error
- type Video
- type WebAPI
- type WebpageMetadata
- type Word
- type XML
Constants ¶
This section is empty.
Variables ¶
var Digits = "0123456789"
var Letters = "abcdefghijklmnopqrstuvwxyz"
Functions ¶
func AddToKnownHosts ¶
func AppendUsingReflect ¶
func AuthenticateTailscale ¶
func Bit ¶
Bit returns the bit value of the bit at index i of b. It panics if i is out of range (1-8).
func CallMethod ¶
CallMethod takes any value, a method name, and an array of JSON-encoded strings. It parses these strings into method arguments and invokes the method, including support for variadic functions. Returns the result of the method call or an error.
func CmdlineServer ¶
CmdlineServer let's you easily turn any http.Handler into a cmdline app.
func CompressDir ¶
CompressDir compresses the specified directory into a .tar.gz file.
func CopyFileFromRemote ¶
func CopyFileToRemote ¶
func DecryptAndDecompressDir ¶
func DeleteCookie ¶
func DeleteCookie(w http.ResponseWriter, name string)
func DownloadDir ¶
func EncryptAndCompressDir ¶
func EncryptedReader ¶
EncryptedReader wraps r with an OFB cipher stream.
func EncryptedWriter ¶
EncryptedWriter wraps w with an OFB cipher stream.
func ErrorHTTP ¶
func ErrorHTTP(w http.ResponseWriter, code int)
func ExecRemote ¶
func FieldValue ¶
func FilterString ¶
func FilterTestFiles ¶
func FrequencyToRGB ¶
FrequencyToRGB converts a light frequency in THz to an RGB hex string.
func GetInstalledGoVersion ¶
func GetLatestGoVersion ¶
func GetPasswordFromStdin ¶
func HandleCORS ¶
func HandleCORS(w http.ResponseWriter, r *http.Request)
func InstallNode ¶
func InstallNode() error
func InstallTailscale ¶
func InstallTailscale() error
func IsAlphaNumeric ¶
func IsLoopbackIP ¶
func IsMutation ¶
func IsPrivateIP ¶
func IsPublicIP ¶
func IsRootRequest ¶
func IsTenDigits ¶
func JSONString ¶
func Kind ¶
func Kind(v interface{}) string
Kind determines the kind of a given value. It returns one of "struct", "map", "list", "scalar" or "null".
func LatestGoVersion ¶
func LatestGoVersion() string
func ListenAndServe ¶
func NewReverseProxy ¶
func NewReverseProxy(backendURL string) *httputil.ReverseProxy
func NormalizeGoName ¶
func NormalizePhoneNumber ¶
func OnFileChange ¶
OnFileChange sets up a watcher that calls `callback()` ONCE each time the file's contents change.
func OnlyLowerCase ¶
func OptionallyServeHTTP ¶
func OptionallyServeHTTP(v any, w http.ResponseWriter, r *http.Request)
func PackageManager ¶
func PackageManager() string
func PascalCase ¶
func PrintResponse ¶
func QuadrupleTime ¶
func QuadrupleTime(fn1, fn2, fn3, fn4 func()) error
Run each fn 250 ms apart forever. Returns an error if a func takes longer than 249 ms to run.
func RandomBits ¶
func RandomBytes ¶
func RandomCode ¶
func RandomDigit ¶
func RandomDigit() int
func RandomElement ¶
func RandomID ¶
func RandomID() string
RandomID returns a 32-byte hex encoded string. The first 8 bytes are a nano-second precision UNIX time-stamp. The next 24 bytes are generated by /dev/urandom.
func RandomString ¶
func RandomToken ¶
func ReadJSONFile ¶
func ReadRemoteFile ¶
func ReloadSystemd ¶
func ReloadSystemd() error
func RequireEnvVar ¶
func RunInParallel ¶
RunInParallel runs each function in fns in its own goroutine, waits for all to finish, and returns a slice of errors (same order, same length).
func RunSSHCommandWithKnownHostsCheck ¶
func RunSSHCommandWithKnownHostsCheck(host, user, cmd string, auth []ssh.AuthMethod) ([]byte, error)
func SSHClientConfig ¶
func SSHClientConfig(user string) (*ssh.ClientConfig, error)
func SecurePassword ¶
func SecurePassword() string
func ServeAny ¶
func ServeAny(v any, w http.ResponseWriter, r *http.Request)
ServeAny serves any Go value. Drill into any exported struct field or map/arary value. Arrays start at 1001. GET requests are served the JSON encoded values. POST requests are used to call methods. Ex request body: `{"Method":"Add","Args":["1","2","3"]}`. All args are JSON-encoded strings. The server will unmarshal each arg into it's appropriate type. Ex response body: `["6","null"]`.
func ServeError ¶
func ServeError(w http.ResponseWriter, code int)
func ServeHTTPS ¶
ServeHTTPS serves h on HTTP and HTTPS ports handling tls.
func ServeMethod ¶
func ServeObject ¶
func SortedKeys ¶
func StartServer ¶
func StripNonAlphaNumeric ¶
func StructToMap ¶
func UnixNanoTimestamp ¶
func UnixNanoTimestamp() string
func UnixTimestamp ¶
func UnixTimestamp() string
func WavelengthToRGB ¶
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, v any)
func WriteJSONFS ¶
WriteJSONFS takes a JSON value and writes it recursively to the filesystem.
func WriteJSONFile ¶
func WriteMethodNotAllowed ¶
func WriteMethodNotAllowed(w http.ResponseWriter)
func WriteNotFound ¶
func WriteNotFound(w http.ResponseWriter)
func WriteTempFile ¶
Types ¶
type API ¶
type App ¶
func (App) HTMLReader ¶
func (a App) HTMLReader() *HTMLReader
type ArrayType ¶
type ArrayType struct { Name Name `json:"name"` Description string `json:"description"` ElemType string `json:"elem_type"` Methods map[string]*Function `json:"methods"` DefaultJSON string `json:"default_json"` }
func (*ArrayType) WriteGoFile ¶
func (*ArrayType) WriteTypeScriptFile ¶
type AuthMethod ¶
type Backend ¶
type Backend struct { DataURL string `json:"dataURL"` GoWorkDir string `json:"goWorkDir"` BinDir string `json:"binDir"` }
type BlogPost ¶
type BlogPost struct { Metadata *WebpageMetadata BodyHTML string }
type BuildConfig ¶
func (*BuildConfig) Build ¶
func (config *BuildConfig) Build() error
type BuildServer ¶
type BuildServer struct { Workdir string Config map[string]*BuildConfig }
func (*BuildServer) ServeHTTP ¶
func (s *BuildServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type CI ¶
type CI struct { PeriodMinutes int SourceDir string OutFile string ServiceName string TwilioClient *TwilioClient AdminPhone string }
func (*CI) Codebase ¶
func (ci *CI) Codebase() *GoCodebase
func (*CI) Serivce ¶
func (ci *CI) Serivce() *SystemdService
type Collection ¶
func (*Collection) List ¶
func (c *Collection) List(limit, after int)
List returns a list of the first `limit` items after
type DB ¶
type DB struct { FS FileSystem Schema struct { Tables map[string]struct { Columns map[string]string } } }
func (*DB) CreateTable ¶
func (*DB) SelectMany ¶
type Expression ¶
type Expression struct { IsLiteral bool `json:"isLiteral"` Value string `json:"value"` IsCall bool `json:"isCall"` Fn *Ref `json:"fn"` Args []*Expression `json:"args"` IsRef bool `json:"isRef"` Ref *Ref `json:"ref"` }
func (*Expression) GoImports ¶
func (ex *Expression) GoImports() map[string]bool
type FancyRoute ¶
type FancyRoute struct { Root http.Handler Static map[string]http.Handler Catchall *FancyRoute VarName string }
func (*FancyRoute) ServeHTTP ¶
func (route *FancyRoute) ServeHTTP(w http.ResponseWriter, r *http.Request)
type FancyRouter ¶
type FancyRouter struct { // Routes. Each key should start with '/'. // To handle the root request, use the key "/". // To define a path variable, use square brackets like "/items/[itemID]". Routes map[string]http.Handler NotFound http.Handler }
FancyRouter handles HTTP requests by matching each request to a handler according to Next.js routing conventions.
func (*FancyRouter) SortedRoutes ¶
func (r *FancyRouter) SortedRoutes() []string
type Field ¶
type FileObject ¶
func (*FileObject[T]) ServeHTTP ¶
func (fo *FileObject[T]) ServeHTTP(w http.ResponseWriter, r *http.Request)
type FileServer ¶
type FileServer struct {
Root string
}
func (*FileServer) ServeHTTP ¶
func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type FileStore ¶
type FileStore struct {
Workdir string
}
FileStore stores and serves files. To use, set up a directory with an `auth.json` file and a `content` directory.
type FileSystem ¶
type Function ¶
type GitRepo ¶
type GitRepo struct {
Dir string
}
type GithubMirror ¶
type GithubMirror struct {
Workdir string
}
func (*GithubMirror) Pull ¶
func (g *GithubMirror) Pull(repo string) error
func (*GithubMirror) ServeHTTP ¶
func (g *GithubMirror) ServeHTTP(w http.ResponseWriter, r *http.Request)
Handle webhooks from github
type GithubRepository ¶
type GithubRepository struct { ID int `json:"id"` NodeID string `json:"node_id"` FullName string `json:"full_name"` }
func (*GithubRepository) SyncLocal ¶
func (repo *GithubRepository) SyncLocal(path string) error
type GithubWebhook ¶
type GithubWebhookRequest ¶
type GithubWebhookRequest struct { Zen string `json:"zen"` HookID int `json:"hook_id"` Hook *GithubWebhook `json:"hook"` Repository *GithubRepository `json:"repository"` }
type GoCodebase ¶
type GoCodebase struct {
Dir string
}
func (GoCodebase) Build ¶
func (c GoCodebase) Build(outFile string) error
func (*GoCodebase) GitRepo ¶
func (c *GoCodebase) GitRepo() *GitRepo
func (*GoCodebase) UpdateDeps ¶
func (c *GoCodebase) UpdateDeps() (bool, error)
type GoDecl ¶
type GoFile ¶
type GoWorkspace ¶
type GoWorkspace struct {
Dir string
}
func (*GoWorkspace) Clone ¶
func (w *GoWorkspace) Clone(pkg string) error
func (*GoWorkspace) Install ¶
func (w *GoWorkspace) Install(pkg string) error
func (*GoWorkspace) Pull ¶
func (w *GoWorkspace) Pull(pkg string) error
func (*GoWorkspace) ServeGithubWebhook ¶
func (ws *GoWorkspace) ServeGithubWebhook(w http.ResponseWriter, r *http.Request)
type HCloudStorageFileSystem ¶
type HCloudStorageFileSystem struct { HetznerStorageBoxAddr string HetznerStorageBoxUsername string HetznerStorageBoxPassword string }
func (*HCloudStorageFileSystem) NewSFTPClient ¶
func (fs *HCloudStorageFileSystem) NewSFTPClient() (*sftp.Client, error)
func (*HCloudStorageFileSystem) NewSSHClient ¶
func (fs *HCloudStorageFileSystem) NewSSHClient() (*ssh.Client, error)
type HTMLDocument ¶
type HTMLReader ¶
func NewHTMLReader ¶
func NewHTMLReader(types map[string]*Type) *HTMLReader
type HTMLTemplateData ¶
type JSONFileServer ¶
type JSONFileServer struct {
Root string
}
func (*JSONFileServer) ServeHTTP ¶
func (fs *JSONFileServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type LiveObject ¶
type LiveObject[T http.Handler] struct { Path string Value T // contains filtered or unexported fields }
func NewLiveObject ¶
func NewLiveObject[T http.Handler](path string, value T) *LiveObject[T]
func (*LiveObject[T]) Load ¶
func (obj *LiveObject[T]) Load()
func (*LiveObject[T]) Save ¶
func (obj *LiveObject[T]) Save() error
func (*LiveObject[T]) ServeHTTP ¶
func (obj *LiveObject[T]) ServeHTTP(w http.ResponseWriter, r *http.Request)
type LocalFileSystem ¶
type LocalFileSystem struct {
Root string
}
func (*LocalFileSystem) Dig ¶
func (fs *LocalFileSystem) Dig(path string) FileSystem
func (*LocalFileSystem) IsDir ¶
func (fs *LocalFileSystem) IsDir(path string) bool
func (*LocalFileSystem) IsFile ¶
func (fs *LocalFileSystem) IsFile(path string) bool
func (*LocalFileSystem) MakeDir ¶
func (fs *LocalFileSystem) MakeDir(path string) error
func (*LocalFileSystem) Remove ¶
func (fs *LocalFileSystem) Remove(path string) error
type MapType ¶
type MapType struct { Name Name `json:"name"` Description string `json:"description"` ElemType string `json:"elem_type"` Methods map[string]*Function `json:"methods"` DefaultJSON string `json:"default_json"` }
func (*MapType) WriteGoFile ¶
func (*MapType) WriteTypeScriptFile ¶
type MethodCall ¶
type MultiHostServer ¶
type MultiHostServer struct { Hosts map[string]http.Handler TwilioClient *TwilioClient AdminPhone string }
func (*MultiHostServer) HostPolicy ¶
func (s *MultiHostServer) HostPolicy(ctx context.Context, host string) error
func (*MultiHostServer) ServeHTTP ¶
func (s *MultiHostServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*MultiHostServer) Start ¶
func (s *MultiHostServer) Start(email, certDir string) error
type MultiUserAuthHandler ¶
type MultiUserAuthHandler struct { AuthFiles FileSystem Twilio *TwilioClient }
func (*MultiUserAuthHandler) Login ¶
func (a *MultiUserAuthHandler) Login(phone, code string) (*Session, error)
func (*MultiUserAuthHandler) SendLoginCode ¶
func (a *MultiUserAuthHandler) SendLoginCode(phone string) error
func (*MultiUserAuthHandler) ServeHTTP ¶
func (a *MultiUserAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Name ¶
type Name []Word
func (Name) GoExported ¶
GoExported returns an exported Go name. Ex: "Green Button" => "GreenButton"
func (Name) PascalCase ¶
type NextApp ¶
type Object ¶
type PhoneNumber ¶
type PhoneNumber string
func (PhoneNumber) Validate ¶
func (phone PhoneNumber) Validate() error
type PingServer ¶
type PingServer struct {
Msg string
}
func (*PingServer) ServeHTTP ¶
func (s *PingServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type PostgresDB ¶
func (*PostgresDB) Open ¶
func (pg *PostgresDB) Open() *sql.DB
type ProgrammingLanguage ¶
type Prompt ¶
type Prompt struct { Name Name Desc string Options []PromptOption }
type PromptOption ¶
type ReactComponent ¶
func (*ReactComponent) Write ¶
func (rc *ReactComponent) Write(path string) error
type ReactElement ¶
type ReactElement struct { Type string Props []struct { Key string Value any } Children []ReactElement }
func (*ReactElement) WriteNextJSPage ¶
func (el *ReactElement) WriteNextJSPage(w io.Writer) error
type RemoteFileSystem ¶
type RemoteFileSystem struct {
Root string
}
func (*RemoteFileSystem) IsDir ¶
func (fs *RemoteFileSystem) IsDir(path string) bool
func (*RemoteFileSystem) IsFile ¶
func (fs *RemoteFileSystem) IsFile(path string) bool
func (*RemoteFileSystem) MakeDir ¶
func (fs *RemoteFileSystem) MakeDir(path string) error
func (*RemoteFileSystem) ReadDir ¶
func (fs *RemoteFileSystem) ReadDir(path string) ([]string, error)
func (*RemoteFileSystem) ReadFile ¶
func (fs *RemoteFileSystem) ReadFile(path string) ([]byte, error)
func (*RemoteFileSystem) Remove ¶
func (fs *RemoteFileSystem) Remove(path string) error
type Request ¶
func NewRequest ¶
type Route ¶
type Route struct { GetRoot http.HandlerFunc PostRoot http.HandlerFunc GetID func(id string, w http.ResponseWriter, r *http.Request) PostID func(id string, w http.ResponseWriter, r *http.Request) PutID func(id string, w http.ResponseWriter, r *http.Request) PatchID func(id string, w http.ResponseWriter, r *http.Request) DeleteID func(id string, w http.ResponseWriter, r *http.Request) }
type Router ¶
type Router struct { Root func(w http.ResponseWriter, r *http.Request) Next func(first string, w http.ResponseWriter, r *http.Request) }
type SHA256Server ¶
func (*SHA256Server) ServeHTTP ¶
func (s *SHA256Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ScalarType ¶
type ScalarType struct { Name Name `json:"name"` Description string `json:"description"` ElemType string `json:"elemType"` Methods map[string]*Function `json:"methods"` DefaultJSON string `json:"defaultJSON"` }
func (*ScalarType) WriteGoFile ¶
func (st *ScalarType) WriteGoFile(path string) error
func (*ScalarType) WriteTypeScriptFile ¶
func (st *ScalarType) WriteTypeScriptFile(path string) error
type SchemaCafe ¶
func (*SchemaCafe) ServeHTTP ¶
func (sc *SchemaCafe) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Service ¶
type SimpleForm ¶
type SimpleForm struct { TitleText string Fields []Field SubmitText string Error error HandlePOST http.HandlerFunc }
func (*SimpleForm) ServeHTTP ¶
func (form *SimpleForm) ServeHTTP(w http.ResponseWriter, r *http.Request)
type SinglePageApp ¶
type SinglePageApp struct {
// contains filtered or unexported fields
}
func (*SinglePageApp) ServeHTTP ¶
func (spa *SinglePageApp) ServeHTTP(w http.ResponseWriter, r *http.Request)
type SingleUserApp ¶
type SingleUserApp struct { Twilio *TwilioClient UserPhone string Files FileSystem Handler http.Handler }
func (*SingleUserApp) AuthFiles ¶
func (a *SingleUserApp) AuthFiles() FileSystem
func (*SingleUserApp) AuthHandler ¶
func (a *SingleUserApp) AuthHandler() *SingleUserAuthHandler
func (*SingleUserApp) Authorized ¶
func (a *SingleUserApp) Authorized(r *http.Request) (bool, error)
func (*SingleUserApp) GetSession ¶
func (a *SingleUserApp) GetSession(token string) (*Session, error)
func (*SingleUserApp) ServeHTTP ¶
func (app *SingleUserApp) ServeHTTP(w http.ResponseWriter, r *http.Request)
type SingleUserAuthHandler ¶
type SingleUserAuthHandler struct { UserPhone string AuthFiles FileSystem Twilio *TwilioClient }
func (*SingleUserAuthHandler) Login ¶
func (a *SingleUserAuthHandler) Login(phone, code string) (*Session, error)
func (*SingleUserAuthHandler) SendLoginCode ¶
func (a *SingleUserAuthHandler) SendLoginCode(phone string) error
func (*SingleUserAuthHandler) ServeHTTP ¶
func (a *SingleUserAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Statement ¶
type Statement struct { IsReturn bool `json:"isReturn"` Return *Expression `json:"return"` IsAssign bool `json:"isAssign"` Name string `json:"name"` Value *Expression `json:"value"` IsIf bool `json:"isIf"` Condition *Expression `json:"condition"` Body []*Statement `json:"body"` }
Statement represents a line of code in a function or method body. There are 4 types of statements: returns, assignments, ifs and loops. Ifs and loops have substatements.
type StreamBroadcaster ¶
type StreamBroadcaster struct { ContentType string StartFunc func() (io.ReadCloser, error) // contains filtered or unexported fields }
func NewStreamBroadcaster ¶
func NewStreamBroadcaster(contentType string, startFunc func() (io.ReadCloser, error)) *StreamBroadcaster
func (*StreamBroadcaster) ServeHTTP ¶
func (sb *StreamBroadcaster) ServeHTTP(w http.ResponseWriter, r *http.Request)
type StreamMultiplexer ¶
type StreamMultiplexer struct {
// contains filtered or unexported fields
}
func NewStreamMultiplexer ¶
func NewStreamMultiplexer(contentType string, backendURL string) *StreamMultiplexer
func (*StreamMultiplexer) ServeHTTP ¶
func (m *StreamMultiplexer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type StructType ¶
type StructType struct { Name Name `json:"name"` Description string `json:"description"` Fields []Field `json:"fields"` Methods map[string]*Function `json:"methods"` DefaultJSON string `json:"default_json"` }
func (*StructType) WriteGoFile ¶
func (t *StructType) WriteGoFile(path, pkgName string) error
func (*StructType) WriteTypeScriptFile ¶
func (t *StructType) WriteTypeScriptFile(path string) error
type SystemdService ¶
type SystemdService struct { Name string Desc string After string Type string Env []Pair[string, string] ExecStart string AutoRestart string WantedBy string }
func (*SystemdService) Restart ¶
func (s *SystemdService) Restart() error
func (*SystemdService) WriteConfig ¶
func (s *SystemdService) WriteConfig(w io.Writer) error
func (*SystemdService) WriteConfigToFile ¶
func (s *SystemdService) WriteConfigToFile() error
type Table ¶
type TableConstraint ¶
type TemplateServer ¶
func NewTemplateServer ¶
func NewTemplateServer[DataType any](tmpl *template.Template, workdir, userID string) *TemplateServer[DataType]
func (*TemplateServer[T]) ServeHTTP ¶
func (s *TemplateServer[T]) ServeHTTP(w http.ResponseWriter, r *http.Request)
type TwilioClient ¶
func (*TwilioClient) SendSMS ¶
func (c *TwilioClient) SendSMS(to, message string) error
type Type ¶
type Type struct { Description string `json:"description"` IsScalar bool `json:"isScalar"` Scalar *Ref `json:"scalar"` IsArray bool `json:"isArray"` IsMap bool `json:"isMap"` ElemType *Type `json:"elemType"` IsStruct bool `json:"isStruct"` Fields []Field `json:"fields"` Methods map[string]*Function `json:"methods"` DefaultJSON string `json:"defaultJSON"` LocalInstanceName string `json:"localInstanceName"` }
type Value ¶
type Value struct { Description string `json:"description"` Type *Type `json:"type"` JSON string `json:"json"` }
func (*Value) WriteGoConstFile ¶
func (*Value) WriteGoVarFile ¶
func (*Value) WriteReactHookFile ¶
func (*Value) WriteTypeScriptConstantFile ¶
type WebAPI ¶
type WebAPI struct { Types map[string]Type RootType string Data FileSystem }
The WebAPI type represents an WebAPI backed by any JSON-serializable Go object.
func (*WebAPI) ServeHTTP ¶
func (api *WebAPI) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves a generic REST API.
func (*WebAPI) ServeNotFound ¶
func (api *WebAPI) ServeNotFound(w http.ResponseWriter, r *http.Request)
type WebpageMetadata ¶
Source Files
¶
- accept.go
- account.go
- action.go
- add_to_known_hosts.go
- api.go
- app.go
- app_config.go
- app_server.go
- append_using_reflect.go
- array.go
- array_type.go
- auth_method.go
- authenticate_tailscale.go
- backend.go
- backup_dir.go
- bit.go
- bool.go
- build_config.go
- build_server.go
- cafe.go
- call_method.go
- ci.go
- client_ip.go
- cmd_server.go
- cmdline_server.go
- collection.go
- compress_dir.go
- content_type.go
- cookie.go
- copy_dir.go
- copy_file.go
- copy_file_from_remote.go
- copy_file_to_remote.go
- create_file.go
- create_p.go
- db.go
- decrypt_and_decompress_dir.go
- delete_cookie.go
- dev_server.go
- digits.go
- download.go
- download_dir.go
- drill.go
- email.go
- encrypt_and_compress_dir.go
- endpoint.go
- env_var.go
- error.go
- error_http.go
- exec_remote.go
- exists.go
- expression.go
- fancy_route.go
- field.go
- field_value.go
- file.go
- file_object.go
- file_server.go
- file_store.go
- file_system.go
- filter_string.go
- filter_test_files.go
- flatten.go
- folder.go
- form.go
- fprint_json.go
- frequency_to_rgb.go
- function.go
- get_addr.go
- get_installed_go_version.go
- get_latest_go_version.go
- get_name.go
- get_osid.go
- get_password_from_stdin.go
- git_repo.go
- github_mirror.go
- github_repository.go
- github_webhook.go
- github_webhook_request.go
- go_builder.go
- go_codebase.go
- go_decl.go
- go_file.go
- go_package.go
- go_workspace.go
- handle_cors.go
- handle_put.go
- has_method.go
- hash_cache.go
- hcloud_file_system.go
- home_dir.go
- html_document.go
- html_head.go
- html_reader.go
- html_template.go
- html_template_data.go
- import_map.go
- install_go.go
- install_node.go
- install_tailscale.go
- int.go
- int_to_id.go
- is_alpha_numeric.go
- is_array.go
- is_bool.go
- is_dir.go
- is_int.go
- is_loopback_ip.go
- is_map.go
- is_mutation.go
- is_private_ip.go
- is_public_ip.go
- is_root_request.go
- is_stdlib.go
- is_string.go
- is_struct.go
- is_ten_digits.go
- join_path.go
- json_file_server.go
- json_string.go
- kebab_case.go
- kind.go
- latest_go_version.go
- letters.go
- link.go
- link_list.go
- list.go
- list_item.go
- listen_and_serve.go
- live_object.go
- local_file_system.go
- main.go
- map.go
- map_keys.go
- map_list.go
- map_type.go
- metadata.go
- method_call.go
- mime_type.go
- movie.go
- multi_host_server.go
- multi_user_auth_handler.go
- must.go
- name.go
- new_object.go
- next_app.go
- next_page.go
- nil.go
- normalize_go_name.go
- normalize_phone_number.go
- object.go
- on_file_change.go
- only_lower_case.go
- only_one.go
- optionally_serve_http.go
- org.go
- os.go
- package_manager.go
- pair.go
- parse_json.go
- parse_path.go
- pascal_case.go
- password_protected.go
- person.go
- personal.go
- phone_number.go
- ping_server.go
- pop.go
- pop_path.go
- port.go
- post.go
- postgres_db.go
- print_json.go
- print_response.go
- programming_language.go
- prompt.go
- quadruple_time.go
- random_bits.go
- random_bytes.go
- random_code.go
- random_digit.go
- random_element.go
- random_id.go
- random_string.go
- random_token.go
- react_component.go
- react_element.go
- react_hook.go
- read_dir.go
- read_go_package_from_disk.go
- read_json.go
- read_json_file.go
- read_json_fs.go
- read_remote_file.go
- ref.go
- reload_systemd.go
- remote_file_system.go
- render_template_to_file.go
- request.go
- require_env_var.go
- response.go
- restore_dir.go
- reverse_proxy.go
- route.go
- router.go
- run.go
- run_in_parallel.go
- run_ssh_with_known_hosts_check.go
- scalar_type.go
- schema.go
- schema_cafe.go
- secure_password.go
- sender.go
- serialize.go
- serve.go
- serve_all.go
- serve_any.go
- serve_bool.go
- serve_error.go
- serve_https.go
- serve_method.go
- serve_mux.go
- serve_my_ip.go
- serve_object.go
- service.go
- session.go
- set.go
- set_field.go
- sha256.go
- sha256_server.go
- sheets_db.go
- simple_form.go
- single_page_app.go
- single_user_app.go
- single_user_auth_handler.go
- snake_case.go
- ssh_client_config.go
- start_server.go
- statement.go
- stream_broadcaster.go
- stream_multiplexer.go
- string.go
- strip_non_alpha_numeric.go
- struct.go
- struct_to_map.go
- struct_type.go
- sub_fs.go
- sync.go
- systemd_service.go
- table.go
- table_constraint.go
- template_server.go
- title_case.go
- touch.go
- tv_episode.go
- tv_season.go
- tv_show.go
- twilio_client.go
- type.go
- unix_nano_timestamp.go
- unix_timestamp.go
- upload_dir.go
- user.go
- user_pass_server.go
- valid_rel_path.go
- value.go
- video.go
- wait_until.go
- watch.go
- wavelength_to_rgb.go
- web_api.go
- webpage_metadata.go
- word.go
- write_encrypted.go
- write_file.go
- write_json.go
- write_json_file.go
- write_json_fs.go
- write_method_not_allowed.go
- write_not_found.go
- write_temp_file.go
- xml.go
- xml_string.go