]> git.giacomolli.uk - onechat/blobdiff - routes.go
Order model and chat declarations
[onechat] / routes.go
index 7dce691ee0bd657e4c35c7bf8cde035d834588dd..02e28e2aac24d1271ad5fc69fb908c02b8c46639 100644 (file)
--- a/routes.go
+++ b/routes.go
@@ -13,6 +13,16 @@ import (
        "go.mau.fi/whatsmeow/types"
 )
 
+// Routes owns the root's source map. Writes replace the private file before
+// changing the map in memory. The mutex protects reads and writes from tools
+// and status commands. Logs omit source IDs, which can hold phone numbers.
+type Routes struct {
+       mutex   sync.Mutex
+       path    string
+       logger  *slog.Logger
+       targets map[string]string
+}
+
 // openRoutes reads the source-to-child map. A missing file has no routes.
 func openRoutes(path string, logger *slog.Logger) (*Routes, error) {
        r := &Routes{
@@ -52,16 +62,6 @@ func openRoutes(path string, logger *slog.Logger) (*Routes, error) {
        return r, nil
 }
 
-// Routes owns the root's source map. Writes replace the private file before
-// changing the map in memory. The mutex protects reads and writes from tools
-// and status commands. Logs omit source IDs, which can hold phone numbers.
-type Routes struct {
-       mutex   sync.Mutex
-       path    string
-       logger  *slog.Logger
-       targets map[string]string
-}
-
 // Set maps source to a child name, or removes it when target is empty. The
 // caller checks that a nonempty target is a child of the root.
 func (r *Routes) Set(source, target string) error {