]> git.giacomolli.uk - onechat/blobdiff - whatsapp_groups.go
Order functions by their first use
[onechat] / whatsapp_groups.go
index 6e9bed3eae9c27c80af78543b5bf4cf15326d939..bc8bb2f67c29bd4e72ad5c9696ac1ef049541f20 100644 (file)
@@ -25,20 +25,11 @@ const (
        whatsappGroupsAge = time.Hour
 )
 
        whatsappGroupsAge = time.Hour
 )
 
-// newWhatsAppGroups returns the names of the groups with no names yet. logger
-// gets the failures of a read.
-func newWhatsAppGroups(logger *slog.Logger) *WhatsAppGroups {
-       return &WhatsAppGroups{
-               logger: logger,
-               names:  make(map[string]string),
-       }
-}
-
 // WhatsAppGroups holds the names of the groups of the account, by the ID of the
 // group. They come from the events of the groups and from reads of the groups
 // from WhatsApp, and they stay in memory only. triedAt is the time of the last
 // WhatsAppGroups holds the names of the groups of the account, by the ID of the
 // group. They come from the events of the groups and from reads of the groups
 // from WhatsApp, and they stay in memory only. triedAt is the time of the last
-// read, and readAt the time of the last read that succeeded. The mutex
-// protects all fields after logger.
+// read, and readAt the time of the last read that succeeded. The mutex protects
+// all fields after logger.
 type WhatsAppGroups struct {
        logger *slog.Logger
 
 type WhatsAppGroups struct {
        logger *slog.Logger
 
@@ -48,6 +39,15 @@ type WhatsAppGroups struct {
        readAt  time.Time
 }
 
        readAt  time.Time
 }
 
+// newWhatsAppGroups returns the names of the groups with no names yet. logger
+// gets the failures of a read.
+func newWhatsAppGroups(logger *slog.Logger) *WhatsAppGroups {
+       return &WhatsAppGroups{
+               logger: logger,
+               names:  make(map[string]string),
+       }
+}
+
 // name returns the name of the group id, or whatsappUnknownGroup. A group that
 // is not in the names reads the groups from WhatsApp with the client of link
 // again, at most once in whatsappGroupsRefresh.
 // name returns the name of the group id, or whatsappUnknownGroup. A group that
 // is not in the names reads the groups from WhatsApp with the client of link
 // again, at most once in whatsappGroupsRefresh.