Compare commits
	
		
			27 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 254fe1556a | |||
| 52e74b59f5 | |||
| 64f2cd7219 | |||
| a29aec8fb5 | |||
| 8ea9b3f79f | |||
| a4b2a0589f | |||
| 4ef5f6059b | |||
| b23a444aa2 | |||
| 09932046f8 | |||
| 37e52595a2 | |||
| 95d7c90492 | |||
| 23a3235c7e | |||
| 506d276962 | |||
| 2a0cf84416 | |||
| 073aa84dd4 | |||
| a0dc9e92e4 | |||
| 98c591b019 | |||
| a93b93a3cd | |||
| 49bc52d63e | |||
| 959020e3c0 | |||
| 395e83acf6 | |||
| 55ff89f179 | |||
| cbaa283f74 | |||
| 20fb1f5601 | |||
| cc58639306 | |||
| cea822ffa6 | |||
| c20ae20cc1 | 
| @@ -5,7 +5,7 @@ A collection of general & useful library methods | |||||||
|  |  | ||||||
| This should not have any heavy dependencies (gin, mongo, etc) and add missing basic language features... | This should not have any heavy dependencies (gin, mongo, etc) and add missing basic language features... | ||||||
|  |  | ||||||
| Potentially needs `export GOPRIVATE="gogs.mikescher.com"` | Potentially needs `export GOPRIVATE="git.blackforestbytes.com"` | ||||||
|  |  | ||||||
|  |  | ||||||
| ## Packages: | ## Packages: | ||||||
|   | |||||||
| @@ -6,10 +6,10 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"go/format" | 	"go/format" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext" | 	"git.blackforestbytes.com/BlackForestBytes/goext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/cryptext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/cryptext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/rext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/rext" | ||||||
| 	"io" | 	"io" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path" | 	"path" | ||||||
|   | |||||||
| @@ -7,9 +7,9 @@ import "crypto/sha256" | |||||||
| import "fmt" | import "fmt" | ||||||
| import "github.com/go-playground/validator/v10" | import "github.com/go-playground/validator/v10" | ||||||
| import "github.com/rs/zerolog/log" | import "github.com/rs/zerolog/log" | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/exerr" | import "git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/langext" | import "git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/rext" | import "git.blackforestbytes.com/BlackForestBytes/goext/rext" | ||||||
| import "math/big" | import "math/big" | ||||||
| import "reflect" | import "reflect" | ||||||
| import "regexp" | import "regexp" | ||||||
| @@ -183,6 +183,10 @@ func (id {{.Name}}) CheckString() string { | |||||||
| 	return getCheckString(prefix{{.Name}}, string(id)) | 	return getCheckString(prefix{{.Name}}, string(id)) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func (id {{.Name}}) IsZero() bool { | ||||||
|  | 	return id == "" | ||||||
|  | } | ||||||
|  |  | ||||||
| func (id {{.Name}}) Regex() rext.Regex { | func (id {{.Name}}) Regex() rext.Regex { | ||||||
| 	return regex{{.Name}} | 	return regex{{.Name}} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,9 +3,9 @@ package bfcodegen | |||||||
| import ( | import ( | ||||||
| 	_ "embed" | 	_ "embed" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/cmdext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/cmdext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| 	"testing" | 	"testing" | ||||||
|   | |||||||
| @@ -6,11 +6,11 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/cryptext" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/rext" | ||||||
| 	"go/format" | 	"go/format" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext" |  | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/cryptext" |  | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/rext" |  | ||||||
| 	"io" | 	"io" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path" | 	"path" | ||||||
| @@ -46,7 +46,7 @@ var rexEnumPackage = rext.W(regexp.MustCompile(`^package\s+(?P<name>[A-Za-z0-9_] | |||||||
|  |  | ||||||
| var rexEnumDef = rext.W(regexp.MustCompile(`^\s*type\s+(?P<name>[A-Za-z0-9_]+)\s+(?P<type>[A-Za-z0-9_]+)\s*//\s*(@enum:type).*$`)) | var rexEnumDef = rext.W(regexp.MustCompile(`^\s*type\s+(?P<name>[A-Za-z0-9_]+)\s+(?P<type>[A-Za-z0-9_]+)\s*//\s*(@enum:type).*$`)) | ||||||
|  |  | ||||||
| var rexEnumValueDef = rext.W(regexp.MustCompile(`^\s*(?P<name>[A-Za-z0-9_]+)\s+(?P<type>[A-Za-z0-9_]+)\s*=\s*(?P<value>("[A-Za-z0-9_:\s\-.]*"|[0-9]+))\s*(//(?P<comm>.*))?.*$`)) | var rexEnumValueDef = rext.W(regexp.MustCompile(`^\s*(?P<name>[A-Za-z0-9_]+)\s+(?P<type>[A-Za-z0-9_]+)\s*=\s*(?P<value>("[/@A-Za-z0-9_:\s\-.]*"|[0-9]+))\s*(//(?P<comm>.*))?.*$`)) | ||||||
|  |  | ||||||
| var rexEnumChecksumConst = rext.W(regexp.MustCompile(`const ChecksumEnumGenerator = "(?P<cs>[A-Za-z0-9_]*)"`)) | var rexEnumChecksumConst = rext.W(regexp.MustCompile(`const ChecksumEnumGenerator = "(?P<cs>[A-Za-z0-9_]*)"`)) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
|  |  | ||||||
| package {{.PkgName}} | package {{.PkgName}} | ||||||
|  |  | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/langext" | import "git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/enums" | import "git.blackforestbytes.com/BlackForestBytes/goext/enums" | ||||||
|  |  | ||||||
| const ChecksumEnumGenerator = "{{.Checksum}}" // GoExtVersion: {{.GoextVersion}} | const ChecksumEnumGenerator = "{{.Checksum}}" // GoExtVersion: {{.GoextVersion}} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,9 +3,9 @@ package bfcodegen | |||||||
| import ( | import ( | ||||||
| 	_ "embed" | 	_ "embed" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/cmdext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/cmdext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| 	"testing" | 	"testing" | ||||||
|   | |||||||
| @@ -6,10 +6,10 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"go/format" | 	"go/format" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext" | 	"git.blackforestbytes.com/BlackForestBytes/goext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/cryptext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/cryptext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/rext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/rext" | ||||||
| 	"io" | 	"io" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path" | 	"path" | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ package {{.PkgName}} | |||||||
| import "go.mongodb.org/mongo-driver/bson" | import "go.mongodb.org/mongo-driver/bson" | ||||||
| import "go.mongodb.org/mongo-driver/bson/bsontype" | import "go.mongodb.org/mongo-driver/bson/bsontype" | ||||||
| import "go.mongodb.org/mongo-driver/bson/primitive" | import "go.mongodb.org/mongo-driver/bson/primitive" | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/exerr" | import "git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
|  |  | ||||||
| const ChecksumIDGenerator = "{{.Checksum}}" // GoExtVersion: {{.GoextVersion}} | const ChecksumIDGenerator = "{{.Checksum}}" // GoExtVersion: {{.GoextVersion}} | ||||||
|  |  | ||||||
| @@ -38,8 +38,17 @@ func (i {{.Name}}) Valid() bool { | |||||||
| func (i {{.Name}}) AsAny() {{$.AnyDef.Name}} { | func (i {{.Name}}) AsAny() {{$.AnyDef.Name}} { | ||||||
| 	return {{$.AnyDef.Name}}(i) | 	return {{$.AnyDef.Name}}(i) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func (i {{.Name}}) AsAnyPtr() *{{$.AnyDef.Name}} { | ||||||
|  |     v := {{$.AnyDef.Name}}(i) | ||||||
|  | 	return &v | ||||||
|  | } | ||||||
| {{end}} | {{end}} | ||||||
|  |  | ||||||
|  | func (i {{.Name}}) IsZero() bool { | ||||||
|  | 	return i == "" | ||||||
|  | } | ||||||
|  |  | ||||||
| func New{{.Name}}() {{.Name}} { | func New{{.Name}}() {{.Name}} { | ||||||
| 	return {{.Name}}(primitive.NewObjectID().Hex()) | 	return {{.Name}}(primitive.NewObjectID().Hex()) | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,9 +3,9 @@ package bfcodegen | |||||||
| import ( | import ( | ||||||
| 	_ "embed" | 	_ "embed" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/cmdext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/cmdext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| 	"testing" | 	"testing" | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package cmdext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,9 +2,9 @@ package cmdext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/mathext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/mathext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/syncext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/syncext" | ||||||
| 	"os/exec" | 	"os/exec" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package cmdext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"bufio" | 	"bufio" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/syncext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/syncext" | ||||||
| 	"io" | 	"io" | ||||||
| 	"sync" | 	"sync" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ package confext | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/timeext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/timeext" | ||||||
| 	"math/bits" | 	"math/bits" | ||||||
| 	"os" | 	"os" | ||||||
| 	"reflect" | 	"reflect" | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| package confext | package confext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/timeext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/timeext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package cryptext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| package cryptext | package cryptext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,8 +8,8 @@ import ( | |||||||
| 	"encoding/hex" | 	"encoding/hex" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/totpext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/totpext" | ||||||
| 	"golang.org/x/crypto/bcrypt" | 	"golang.org/x/crypto/bcrypt" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| package cryptext | package cryptext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/totpext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/totpext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ package cursortoken | |||||||
| import ( | import ( | ||||||
| 	"encoding/base32" | 	"encoding/base32" | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
|   | |||||||
							
								
								
									
										132
									
								
								dataext/delayedCombiningInvoker.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								dataext/delayedCombiningInvoker.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,132 @@ | |||||||
|  | package dataext | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"context" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/syncext" | ||||||
|  | 	"sync" | ||||||
|  | 	"time" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | type DelayedCombiningInvoker struct { | ||||||
|  | 	syncLock           sync.Mutex | ||||||
|  | 	triggerChan        chan bool | ||||||
|  | 	cancelChan         chan bool | ||||||
|  | 	execNowChan        chan bool | ||||||
|  | 	action             func() | ||||||
|  | 	delay              time.Duration | ||||||
|  | 	maxDelay           time.Duration | ||||||
|  | 	executorRunning    *syncext.AtomicBool | ||||||
|  | 	lastRequestTime    time.Time | ||||||
|  | 	initialRequestTime time.Time | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func NewDelayedCombiningInvoker(action func(), delay time.Duration, maxDelay time.Duration) *DelayedCombiningInvoker { | ||||||
|  | 	return &DelayedCombiningInvoker{ | ||||||
|  | 		action:             action, | ||||||
|  | 		delay:              delay, | ||||||
|  | 		maxDelay:           maxDelay, | ||||||
|  | 		executorRunning:    syncext.NewAtomicBool(false), | ||||||
|  | 		triggerChan:        make(chan bool), | ||||||
|  | 		cancelChan:         make(chan bool, 1), | ||||||
|  | 		execNowChan:        make(chan bool, 1), | ||||||
|  | 		lastRequestTime:    time.Now(), | ||||||
|  | 		initialRequestTime: time.Now(), | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (d *DelayedCombiningInvoker) Request() { | ||||||
|  | 	now := time.Now() | ||||||
|  |  | ||||||
|  | 	d.syncLock.Lock() | ||||||
|  | 	defer d.syncLock.Unlock() | ||||||
|  |  | ||||||
|  | 	if d.executorRunning.Get() { | ||||||
|  | 		d.lastRequestTime = now | ||||||
|  |  | ||||||
|  | 		d.triggerChan <- true | ||||||
|  | 	} else { | ||||||
|  | 		d.initialRequestTime = now | ||||||
|  | 		d.lastRequestTime = now | ||||||
|  |  | ||||||
|  | 		d.executorRunning.Set(true) | ||||||
|  | 		syncext.ReadNonBlocking(d.triggerChan) // clear the channel | ||||||
|  | 		syncext.ReadNonBlocking(d.cancelChan)  // clear the channel | ||||||
|  | 		syncext.ReadNonBlocking(d.execNowChan) // clear the channel | ||||||
|  | 		go d.run() | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (d *DelayedCombiningInvoker) run() { | ||||||
|  | 	defer func() { | ||||||
|  | 		d.syncLock.Lock() | ||||||
|  | 		d.executorRunning.Set(false) | ||||||
|  | 		d.syncLock.Unlock() | ||||||
|  | 	}() | ||||||
|  |  | ||||||
|  | 	for { | ||||||
|  | 		d.syncLock.Lock() | ||||||
|  | 		timeOut := min(d.maxDelay-time.Since(d.initialRequestTime), d.delay-time.Since(d.lastRequestTime)) | ||||||
|  | 		if timeOut < 0 { | ||||||
|  | 			timeOut = 0 | ||||||
|  | 		} | ||||||
|  | 		d.syncLock.Unlock() | ||||||
|  |  | ||||||
|  | 		immediately := false | ||||||
|  |  | ||||||
|  | 		select { | ||||||
|  | 		case <-d.execNowChan: | ||||||
|  | 			// run immediately | ||||||
|  | 			immediately = true | ||||||
|  | 			break | ||||||
|  | 		case <-d.triggerChan: | ||||||
|  | 			// external trigger - needs to re-evaluate | ||||||
|  | 			break | ||||||
|  | 		case <-d.cancelChan: | ||||||
|  | 			// cancel | ||||||
|  | 			return | ||||||
|  | 		case <-time.After(timeOut): | ||||||
|  | 			// time elapsed - check for execution | ||||||
|  | 			break | ||||||
|  |  | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		d.syncLock.Lock() | ||||||
|  | 		execute := immediately || time.Since(d.lastRequestTime) >= d.delay || time.Since(d.initialRequestTime) >= d.maxDelay | ||||||
|  | 		if !execute { | ||||||
|  | 			d.syncLock.Unlock() | ||||||
|  | 			continue | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		_ = langext.RunPanicSafe(d.action) | ||||||
|  | 		d.syncLock.Unlock() | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (d *DelayedCombiningInvoker) CancelPendingRequests() { | ||||||
|  | 	d.syncLock.Lock() | ||||||
|  | 	defer d.syncLock.Unlock() | ||||||
|  |  | ||||||
|  | 	syncext.WriteNonBlocking(d.cancelChan, true) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (d *DelayedCombiningInvoker) HasPendingRequests() bool { | ||||||
|  | 	return d.executorRunning.Get() | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (d *DelayedCombiningInvoker) ExecuteNow() bool { | ||||||
|  | 	d.syncLock.Lock() | ||||||
|  | 	defer d.syncLock.Unlock() | ||||||
|  |  | ||||||
|  | 	if d.executorRunning.Get() { | ||||||
|  | 		syncext.WriteNonBlocking(d.execNowChan, true) | ||||||
|  | 		return true | ||||||
|  | 	} else { | ||||||
|  | 		return false | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (d *DelayedCombiningInvoker) WaitForCompletion(ctx context.Context) error { | ||||||
|  | 	return d.executorRunning.WaitWithContext(ctx, false) | ||||||
|  | } | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| package dataext | package dataext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"math/rand" | 	"math/rand" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"testing" | 	"testing" | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| package dataext | package dataext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ package dataext | |||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type JsonOpt[T any] struct { | type JsonOpt[T any] struct { | ||||||
|   | |||||||
							
								
								
									
										241
									
								
								dataext/pubsub.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										241
									
								
								dataext/pubsub.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,241 @@ | |||||||
|  | package dataext | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"context" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/syncext" | ||||||
|  | 	"github.com/rs/xid" | ||||||
|  | 	"iter" | ||||||
|  | 	"sync" | ||||||
|  | 	"time" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | // PubSub is a simple Pub/Sub Broker | ||||||
|  | // Clients can subscribe to a namespace and receive published messages on this namespace | ||||||
|  | // Messages are broadcast to all subscribers | ||||||
|  | type PubSub[TNamespace comparable, TData any] struct { | ||||||
|  | 	masterLock *sync.Mutex | ||||||
|  |  | ||||||
|  | 	subscriptions map[TNamespace][]*pubSubSubscription[TNamespace, TData] | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type PubSubSubscription interface { | ||||||
|  | 	Unsubscribe() | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type pubSubSubscription[TNamespace comparable, TData any] struct { | ||||||
|  | 	ID string | ||||||
|  |  | ||||||
|  | 	parent    *PubSub[TNamespace, TData] | ||||||
|  | 	namespace TNamespace | ||||||
|  |  | ||||||
|  | 	subLock *sync.Mutex | ||||||
|  |  | ||||||
|  | 	Func func(TData) | ||||||
|  | 	Chan chan TData | ||||||
|  |  | ||||||
|  | 	UnsubChan chan bool | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (p *pubSubSubscription[TNamespace, TData]) Unsubscribe() { | ||||||
|  | 	p.parent.unsubscribe(p) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func NewPubSub[TNamespace comparable, TData any](capacity int) *PubSub[TNamespace, TData] { | ||||||
|  | 	return &PubSub[TNamespace, TData]{ | ||||||
|  | 		masterLock:    &sync.Mutex{}, | ||||||
|  | 		subscriptions: make(map[TNamespace][]*pubSubSubscription[TNamespace, TData], capacity), | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (ps *PubSub[TNamespace, TData]) Namespaces() []TNamespace { | ||||||
|  | 	ps.masterLock.Lock() | ||||||
|  | 	defer ps.masterLock.Unlock() | ||||||
|  |  | ||||||
|  | 	return langext.MapKeyArr(ps.subscriptions) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (ps *PubSub[TNamespace, TData]) SubscriberCount(ns TNamespace) int { | ||||||
|  | 	ps.masterLock.Lock() | ||||||
|  | 	defer ps.masterLock.Unlock() | ||||||
|  |  | ||||||
|  | 	return len(ps.subscriptions[ns]) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // Publish sends `data` to all subscriber | ||||||
|  | // But unbuffered - if one is currently not listening, we skip (the actualReceiver < subscriber) | ||||||
|  | func (ps *PubSub[TNamespace, TData]) Publish(ns TNamespace, data TData) (subscriber int, actualReceiver int) { | ||||||
|  | 	ps.masterLock.Lock() | ||||||
|  | 	subs := langext.ArrCopy(ps.subscriptions[ns]) | ||||||
|  | 	ps.masterLock.Unlock() | ||||||
|  |  | ||||||
|  | 	subscriber = len(subs) | ||||||
|  | 	actualReceiver = 0 | ||||||
|  |  | ||||||
|  | 	for _, sub := range subs { | ||||||
|  | 		func() { | ||||||
|  | 			sub.subLock.Lock() | ||||||
|  | 			defer sub.subLock.Unlock() | ||||||
|  |  | ||||||
|  | 			if sub.Func != nil { | ||||||
|  | 				go func() { sub.Func(data) }() | ||||||
|  | 				actualReceiver++ | ||||||
|  | 			} else if sub.Chan != nil { | ||||||
|  | 				msgSent := syncext.WriteNonBlocking(sub.Chan, data) | ||||||
|  | 				if msgSent { | ||||||
|  | 					actualReceiver++ | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		}() | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return subscriber, actualReceiver | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // PublishWithContext sends `data` to all subscriber | ||||||
|  | // buffered - if one is currently not listening, we wait (but error out when the context runs out) | ||||||
|  | func (ps *PubSub[TNamespace, TData]) PublishWithContext(ctx context.Context, ns TNamespace, data TData) (subscriber int, actualReceiver int, err error) { | ||||||
|  | 	ps.masterLock.Lock() | ||||||
|  | 	subs := langext.ArrCopy(ps.subscriptions[ns]) | ||||||
|  | 	ps.masterLock.Unlock() | ||||||
|  |  | ||||||
|  | 	subscriber = len(subs) | ||||||
|  | 	actualReceiver = 0 | ||||||
|  |  | ||||||
|  | 	for _, sub := range subs { | ||||||
|  | 		err := func() error { | ||||||
|  | 			sub.subLock.Lock() | ||||||
|  | 			defer sub.subLock.Unlock() | ||||||
|  |  | ||||||
|  | 			if err := ctx.Err(); err != nil { | ||||||
|  | 				return err | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			if sub.Func != nil { | ||||||
|  | 				go func() { sub.Func(data) }() | ||||||
|  | 				actualReceiver++ | ||||||
|  | 			} else if sub.Chan != nil { | ||||||
|  | 				err := syncext.WriteChannelWithContext(ctx, sub.Chan, data) | ||||||
|  | 				if err != nil { | ||||||
|  | 					return err | ||||||
|  | 				} | ||||||
|  | 				actualReceiver++ | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			return nil | ||||||
|  | 		}() | ||||||
|  | 		if err != nil { | ||||||
|  | 			return subscriber, actualReceiver, err | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return subscriber, actualReceiver, nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // PublishWithTimeout sends `data` to all subscriber | ||||||
|  | // buffered - if one is currently not listening, we wait (but wait at most `timeout` - if the timeout is exceeded then actualReceiver < subscriber) | ||||||
|  | func (ps *PubSub[TNamespace, TData]) PublishWithTimeout(ns TNamespace, data TData, timeout time.Duration) (subscriber int, actualReceiver int) { | ||||||
|  | 	ps.masterLock.Lock() | ||||||
|  | 	subs := langext.ArrCopy(ps.subscriptions[ns]) | ||||||
|  | 	ps.masterLock.Unlock() | ||||||
|  |  | ||||||
|  | 	subscriber = len(subs) | ||||||
|  | 	actualReceiver = 0 | ||||||
|  |  | ||||||
|  | 	for _, sub := range subs { | ||||||
|  | 		func() { | ||||||
|  | 			sub.subLock.Lock() | ||||||
|  | 			defer sub.subLock.Unlock() | ||||||
|  |  | ||||||
|  | 			if sub.Func != nil { | ||||||
|  | 				go func() { sub.Func(data) }() | ||||||
|  | 				actualReceiver++ | ||||||
|  | 			} else if sub.Chan != nil { | ||||||
|  | 				ok := syncext.WriteChannelWithTimeout(sub.Chan, data, timeout) | ||||||
|  | 				if ok { | ||||||
|  | 					actualReceiver++ | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		}() | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return subscriber, actualReceiver | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (ps *PubSub[TNamespace, TData]) SubscribeByCallback(ns TNamespace, fn func(TData)) PubSubSubscription { | ||||||
|  | 	ps.masterLock.Lock() | ||||||
|  | 	defer ps.masterLock.Unlock() | ||||||
|  |  | ||||||
|  | 	sub := &pubSubSubscription[TNamespace, TData]{ID: xid.New().String(), namespace: ns, parent: ps, subLock: &sync.Mutex{}, Func: fn, UnsubChan: nil} | ||||||
|  |  | ||||||
|  | 	ps.subscriptions[ns] = append(ps.subscriptions[ns], sub) | ||||||
|  |  | ||||||
|  | 	return sub | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (ps *PubSub[TNamespace, TData]) SubscribeByChan(ns TNamespace, chanBufferSize int) (chan TData, PubSubSubscription) { | ||||||
|  | 	ps.masterLock.Lock() | ||||||
|  | 	defer ps.masterLock.Unlock() | ||||||
|  |  | ||||||
|  | 	msgCh := make(chan TData, chanBufferSize) | ||||||
|  |  | ||||||
|  | 	sub := &pubSubSubscription[TNamespace, TData]{ID: xid.New().String(), namespace: ns, parent: ps, subLock: &sync.Mutex{}, Chan: msgCh, UnsubChan: nil} | ||||||
|  |  | ||||||
|  | 	ps.subscriptions[ns] = append(ps.subscriptions[ns], sub) | ||||||
|  |  | ||||||
|  | 	return msgCh, sub | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (ps *PubSub[TNamespace, TData]) SubscribeByIter(ns TNamespace, chanBufferSize int) (iter.Seq[TData], PubSubSubscription) { | ||||||
|  | 	ps.masterLock.Lock() | ||||||
|  | 	defer ps.masterLock.Unlock() | ||||||
|  |  | ||||||
|  | 	msgCh := make(chan TData, chanBufferSize) | ||||||
|  | 	unsubChan := make(chan bool, 8) | ||||||
|  |  | ||||||
|  | 	sub := &pubSubSubscription[TNamespace, TData]{ID: xid.New().String(), namespace: ns, parent: ps, subLock: &sync.Mutex{}, Chan: msgCh, UnsubChan: unsubChan} | ||||||
|  |  | ||||||
|  | 	ps.subscriptions[ns] = append(ps.subscriptions[ns], sub) | ||||||
|  |  | ||||||
|  | 	iterFun := func(yield func(TData) bool) { | ||||||
|  | 		for { | ||||||
|  | 			select { | ||||||
|  | 			case msg := <-msgCh: | ||||||
|  | 				if !yield(msg) { | ||||||
|  | 					sub.Unsubscribe() | ||||||
|  | 					return | ||||||
|  | 				} | ||||||
|  | 			case <-sub.UnsubChan: | ||||||
|  | 				sub.Unsubscribe() | ||||||
|  | 				return | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return iterFun, sub | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (ps *PubSub[TNamespace, TData]) unsubscribe(p *pubSubSubscription[TNamespace, TData]) { | ||||||
|  | 	ps.masterLock.Lock() | ||||||
|  | 	defer ps.masterLock.Unlock() | ||||||
|  |  | ||||||
|  | 	p.subLock.Lock() | ||||||
|  | 	defer p.subLock.Unlock() | ||||||
|  |  | ||||||
|  | 	if p.Chan != nil { | ||||||
|  | 		close(p.Chan) | ||||||
|  | 		p.Chan = nil | ||||||
|  | 	} | ||||||
|  | 	if p.UnsubChan != nil { | ||||||
|  | 		syncext.WriteNonBlocking(p.UnsubChan, true) | ||||||
|  | 		close(p.UnsubChan) | ||||||
|  | 		p.UnsubChan = nil | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	ps.subscriptions[p.namespace] = langext.ArrFilter(ps.subscriptions[p.namespace], func(v *pubSubSubscription[TNamespace, TData]) bool { | ||||||
|  | 		return v.ID != p.ID | ||||||
|  | 	}) | ||||||
|  | 	if len(ps.subscriptions[p.namespace]) == 0 { | ||||||
|  | 		delete(ps.subscriptions, p.namespace) | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										428
									
								
								dataext/pubsub_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										428
									
								
								dataext/pubsub_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,428 @@ | |||||||
|  | package dataext | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"context" | ||||||
|  | 	"sync" | ||||||
|  | 	"testing" | ||||||
|  | 	"time" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | func TestNewPubSub(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  | 	if ps == nil { | ||||||
|  | 		t.Fatal("NewPubSub returned nil") | ||||||
|  | 	} | ||||||
|  | 	if ps.masterLock == nil { | ||||||
|  | 		t.Fatal("masterLock is nil") | ||||||
|  | 	} | ||||||
|  | 	if ps.subscriptions == nil { | ||||||
|  | 		t.Fatal("subscriptions is nil") | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestPubSub_Namespaces(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  |  | ||||||
|  | 	// Initially no namespaces | ||||||
|  | 	namespaces := ps.Namespaces() | ||||||
|  | 	if len(namespaces) != 0 { | ||||||
|  | 		t.Fatalf("Expected 0 namespaces, got %d", len(namespaces)) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Add a subscription to create a namespace | ||||||
|  | 	_, sub1 := ps.SubscribeByChan("test-ns1", 1) | ||||||
|  | 	defer sub1.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Add another subscription to a different namespace | ||||||
|  | 	_, sub2 := ps.SubscribeByChan("test-ns2", 1) | ||||||
|  | 	defer sub2.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Check namespaces | ||||||
|  | 	namespaces = ps.Namespaces() | ||||||
|  | 	if len(namespaces) != 2 { | ||||||
|  | 		t.Fatalf("Expected 2 namespaces, got %d", len(namespaces)) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Check if namespaces contain the expected values | ||||||
|  | 	found1, found2 := false, false | ||||||
|  | 	for _, ns := range namespaces { | ||||||
|  | 		if ns == "test-ns1" { | ||||||
|  | 			found1 = true | ||||||
|  | 		} | ||||||
|  | 		if ns == "test-ns2" { | ||||||
|  | 			found2 = true | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if !found1 || !found2 { | ||||||
|  | 		t.Fatalf("Expected to find both namespaces, found ns1: %v, ns2: %v", found1, found2) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestPubSub_SubscribeByCallback(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  |  | ||||||
|  | 	var received string | ||||||
|  | 	var wg sync.WaitGroup | ||||||
|  | 	wg.Add(1) | ||||||
|  |  | ||||||
|  | 	callback := func(msg string) { | ||||||
|  | 		received = msg | ||||||
|  | 		wg.Done() | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	sub := ps.SubscribeByCallback("test-ns", callback) | ||||||
|  | 	defer sub.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Publish a message | ||||||
|  | 	subs, receivers := ps.Publish("test-ns", "hello") | ||||||
|  |  | ||||||
|  | 	if subs != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 subscriber, got %d", subs) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if receivers != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 receiver, got %d", receivers) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Wait for the callback to be executed | ||||||
|  | 	wg.Wait() | ||||||
|  |  | ||||||
|  | 	if received != "hello" { | ||||||
|  | 		t.Fatalf("Expected to receive 'hello', got '%s'", received) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestPubSub_SubscribeByChan(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  |  | ||||||
|  | 	ch, sub := ps.SubscribeByChan("test-ns", 1) | ||||||
|  | 	defer sub.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Publish a message | ||||||
|  | 	subs, receivers := ps.Publish("test-ns", "hello") | ||||||
|  |  | ||||||
|  | 	if subs != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 subscriber, got %d", subs) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if receivers != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 receiver, got %d", receivers) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Read from the channel with a timeout to avoid blocking | ||||||
|  | 	select { | ||||||
|  | 	case msg := <-ch: | ||||||
|  | 		if msg != "hello" { | ||||||
|  | 			t.Fatalf("Expected to receive 'hello', got '%s'", msg) | ||||||
|  | 		} | ||||||
|  | 	case <-time.After(time.Second): | ||||||
|  | 		t.Fatal("Timed out waiting for message") | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestPubSub_SubscribeByIter(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  |  | ||||||
|  | 	iterSeq, sub := ps.SubscribeByIter("test-ns", 1) | ||||||
|  | 	defer sub.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Channel to communicate when message is received | ||||||
|  | 	done := make(chan bool) | ||||||
|  | 	received := false | ||||||
|  |  | ||||||
|  | 	// Start a goroutine to use the iterator | ||||||
|  | 	go func() { | ||||||
|  | 		for msg := range iterSeq { | ||||||
|  | 			if msg == "hello" { | ||||||
|  | 				received = true | ||||||
|  | 				done <- true | ||||||
|  | 				return // Stop iteration | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	}() | ||||||
|  |  | ||||||
|  | 	// Give time for the iterator to start | ||||||
|  | 	time.Sleep(100 * time.Millisecond) | ||||||
|  |  | ||||||
|  | 	// Publish a message | ||||||
|  | 	ps.Publish("test-ns", "hello") | ||||||
|  |  | ||||||
|  | 	// Wait for the message to be received or timeout | ||||||
|  | 	select { | ||||||
|  | 	case <-done: | ||||||
|  | 		if !received { | ||||||
|  | 			t.Fatal("Message was received but not 'hello'") | ||||||
|  | 		} | ||||||
|  | 	case <-time.After(time.Second): | ||||||
|  | 		t.Fatal("Timed out waiting for message") | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	subCount := ps.SubscriberCount("test-ns") | ||||||
|  | 	if subCount != 0 { | ||||||
|  | 		t.Fatalf("Expected 0 receivers, got %d", subCount) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestPubSub_Publish(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  |  | ||||||
|  | 	// Test publishing to a namespace with no subscribers | ||||||
|  | 	subs, receivers := ps.Publish("empty-ns", "hello") | ||||||
|  | 	if subs != 0 { | ||||||
|  | 		t.Fatalf("Expected 0 subscribers, got %d", subs) | ||||||
|  | 	} | ||||||
|  | 	if receivers != 0 { | ||||||
|  | 		t.Fatalf("Expected 0 receivers, got %d", receivers) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Add a subscriber | ||||||
|  | 	ch, sub := ps.SubscribeByChan("test-ns", 1) | ||||||
|  | 	defer sub.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Publish a message | ||||||
|  | 	subs, receivers = ps.Publish("test-ns", "hello") | ||||||
|  | 	if subs != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 subscriber, got %d", subs) | ||||||
|  | 	} | ||||||
|  | 	if receivers != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 receiver, got %d", receivers) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Verify the message was received | ||||||
|  | 	select { | ||||||
|  | 	case msg := <-ch: | ||||||
|  | 		if msg != "hello" { | ||||||
|  | 			t.Fatalf("Expected to receive 'hello', got '%s'", msg) | ||||||
|  | 		} | ||||||
|  | 	case <-time.After(time.Second): | ||||||
|  | 		t.Fatal("Timed out waiting for message") | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Test non-blocking behavior with a full channel | ||||||
|  | 	// First fill the channel | ||||||
|  | 	ps.Publish("test-ns", "fill") | ||||||
|  |  | ||||||
|  | 	// Now publish again - this should not block but skip the receiver | ||||||
|  | 	subs, receivers = ps.Publish("test-ns", "overflow") | ||||||
|  | 	if subs != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 subscriber, got %d", subs) | ||||||
|  | 	} | ||||||
|  | 	// The receiver count might be 0 if the channel is full | ||||||
|  |  | ||||||
|  | 	// Drain the channel | ||||||
|  | 	<-ch | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestPubSub_PublishWithTimeout(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  |  | ||||||
|  | 	// Add a subscriber with a channel | ||||||
|  | 	ch, sub := ps.SubscribeByChan("test-ns", 1) | ||||||
|  | 	defer sub.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Publish with a timeout | ||||||
|  | 	subs, receivers := ps.PublishWithTimeout("test-ns", "hello", 100*time.Millisecond) | ||||||
|  | 	if subs != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 subscriber, got %d", subs) | ||||||
|  | 	} | ||||||
|  | 	if receivers != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 receiver, got %d", receivers) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Verify the message was received | ||||||
|  | 	select { | ||||||
|  | 	case msg := <-ch: | ||||||
|  | 		if msg != "hello" { | ||||||
|  | 			t.Fatalf("Expected to receive 'hello', got '%s'", msg) | ||||||
|  | 		} | ||||||
|  | 	case <-time.After(time.Second): | ||||||
|  | 		t.Fatal("Timed out waiting for message") | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Fill the channel | ||||||
|  | 	ps.Publish("test-ns", "fill") | ||||||
|  |  | ||||||
|  | 	// Test timeout behavior with a full channel | ||||||
|  | 	start := time.Now() | ||||||
|  | 	subs, receivers = ps.PublishWithTimeout("test-ns", "timeout-test", 50*time.Millisecond) | ||||||
|  | 	elapsed := time.Since(start) | ||||||
|  |  | ||||||
|  | 	if subs != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 subscriber, got %d", subs) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// The receiver count should be 0 if the timeout occurred | ||||||
|  | 	if elapsed < 50*time.Millisecond { | ||||||
|  | 		t.Fatalf("Expected to wait at least 50ms, only waited %v", elapsed) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Drain the channel | ||||||
|  | 	<-ch | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestPubSub_PublishWithContext(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  |  | ||||||
|  | 	// Add a subscriber with a channel | ||||||
|  | 	ch, sub := ps.SubscribeByChan("test-ns", 1) | ||||||
|  | 	defer sub.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Create a context | ||||||
|  | 	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond) | ||||||
|  | 	defer cancel() | ||||||
|  |  | ||||||
|  | 	// Publish with context | ||||||
|  | 	subs, receivers, err := ps.PublishWithContext(ctx, "test-ns", "hello") | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("Unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  | 	if subs != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 subscriber, got %d", subs) | ||||||
|  | 	} | ||||||
|  | 	if receivers != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 receiver, got %d", receivers) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Verify the message was received | ||||||
|  | 	select { | ||||||
|  | 	case msg := <-ch: | ||||||
|  | 		if msg != "hello" { | ||||||
|  | 			t.Fatalf("Expected to receive 'hello', got '%s'", msg) | ||||||
|  | 		} | ||||||
|  | 	case <-time.After(time.Second): | ||||||
|  | 		t.Fatal("Timed out waiting for message") | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Fill the channel | ||||||
|  | 	ps.Publish("test-ns", "fill") | ||||||
|  |  | ||||||
|  | 	// Test context cancellation with a full channel | ||||||
|  | 	ctx, cancel = context.WithCancel(context.Background()) | ||||||
|  |  | ||||||
|  | 	// Cancel the context after a short delay | ||||||
|  | 	go func() { | ||||||
|  | 		time.Sleep(50 * time.Millisecond) | ||||||
|  | 		cancel() | ||||||
|  | 	}() | ||||||
|  |  | ||||||
|  | 	start := time.Now() | ||||||
|  | 	subs, receivers, err = ps.PublishWithContext(ctx, "test-ns", "context-test") | ||||||
|  | 	elapsed := time.Since(start) | ||||||
|  |  | ||||||
|  | 	if subs != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 subscriber, got %d", subs) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Should get a context canceled error | ||||||
|  | 	if err == nil { | ||||||
|  | 		t.Fatal("Expected context canceled error, got nil") | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if elapsed < 50*time.Millisecond { | ||||||
|  | 		t.Fatalf("Expected to wait at least 50ms, only waited %v", elapsed) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Drain the channel | ||||||
|  | 	<-ch | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestPubSub_Unsubscribe(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  |  | ||||||
|  | 	// Add a subscriber | ||||||
|  | 	ch, sub := ps.SubscribeByChan("test-ns", 1) | ||||||
|  |  | ||||||
|  | 	// Publish a message | ||||||
|  | 	subs, receivers := ps.Publish("test-ns", "hello") | ||||||
|  | 	if subs != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 subscriber, got %d", subs) | ||||||
|  | 	} | ||||||
|  | 	if receivers != 1 { | ||||||
|  | 		t.Fatalf("Expected 1 receiver, got %d", receivers) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Verify the message was received | ||||||
|  | 	select { | ||||||
|  | 	case msg := <-ch: | ||||||
|  | 		if msg != "hello" { | ||||||
|  | 			t.Fatalf("Expected to receive 'hello', got '%s'", msg) | ||||||
|  | 		} | ||||||
|  | 	case <-time.After(time.Second): | ||||||
|  | 		t.Fatal("Timed out waiting for message") | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Unsubscribe | ||||||
|  | 	sub.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Publish again | ||||||
|  | 	subs, receivers = ps.Publish("test-ns", "after-unsub") | ||||||
|  | 	if subs != 0 { | ||||||
|  | 		t.Fatalf("Expected 0 subscribers after unsubscribe, got %d", subs) | ||||||
|  | 	} | ||||||
|  | 	if receivers != 0 { | ||||||
|  | 		t.Fatalf("Expected 0 receivers after unsubscribe, got %d", receivers) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Check that the namespace is removed | ||||||
|  | 	namespaces := ps.Namespaces() | ||||||
|  | 	if len(namespaces) != 0 { | ||||||
|  | 		t.Fatalf("Expected 0 namespaces after unsubscribe, got %d", len(namespaces)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestPubSub_MultipleSubscribers(t *testing.T) { | ||||||
|  | 	ps := NewPubSub[string, string](10) | ||||||
|  |  | ||||||
|  | 	// Add multiple subscribers | ||||||
|  | 	ch1, sub1 := ps.SubscribeByChan("test-ns", 1) | ||||||
|  | 	defer sub1.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	ch2, sub2 := ps.SubscribeByChan("test-ns", 1) | ||||||
|  | 	defer sub2.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	var received string | ||||||
|  | 	var wg sync.WaitGroup | ||||||
|  | 	wg.Add(1) | ||||||
|  |  | ||||||
|  | 	sub3 := ps.SubscribeByCallback("test-ns", func(msg string) { | ||||||
|  | 		received = msg | ||||||
|  | 		wg.Done() | ||||||
|  | 	}) | ||||||
|  | 	defer sub3.Unsubscribe() | ||||||
|  |  | ||||||
|  | 	// Publish a message | ||||||
|  | 	subs, receivers := ps.Publish("test-ns", "hello") | ||||||
|  | 	if subs != 3 { | ||||||
|  | 		t.Fatalf("Expected 3 subscribers, got %d", subs) | ||||||
|  | 	} | ||||||
|  | 	if receivers != 3 { | ||||||
|  | 		t.Fatalf("Expected 3 receivers, got %d", receivers) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Verify the message was received by all subscribers | ||||||
|  | 	select { | ||||||
|  | 	case msg := <-ch1: | ||||||
|  | 		if msg != "hello" { | ||||||
|  | 			t.Fatalf("Expected ch1 to receive 'hello', got '%s'", msg) | ||||||
|  | 		} | ||||||
|  | 	case <-time.After(time.Second): | ||||||
|  | 		t.Fatal("Timed out waiting for message on ch1") | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	select { | ||||||
|  | 	case msg := <-ch2: | ||||||
|  | 		if msg != "hello" { | ||||||
|  | 			t.Fatalf("Expected ch2 to receive 'hello', got '%s'", msg) | ||||||
|  | 		} | ||||||
|  | 	case <-time.After(time.Second): | ||||||
|  | 		t.Fatal("Timed out waiting for message on ch2") | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Wait for the callback | ||||||
|  | 	wg.Wait() | ||||||
|  |  | ||||||
|  | 	if received != "hello" { | ||||||
|  | 		t.Fatalf("Expected callback to receive 'hello', got '%s'", received) | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -2,7 +2,7 @@ package dataext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"sync" | 	"sync" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ import ( | |||||||
| 	"encoding/binary" | 	"encoding/binary" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"hash" | 	"hash" | ||||||
| 	"io" | 	"io" | ||||||
| 	"reflect" | 	"reflect" | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| package dataext | package dataext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -119,6 +119,32 @@ func (s *SyncMap[TKey, TData]) Delete(key TKey) bool { | |||||||
| 	return ok | 	return ok | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func (s *SyncMap[TKey, TData]) DeleteIf(fn func(key TKey, data TData) bool) int { | ||||||
|  | 	s.lock.Lock() | ||||||
|  | 	defer s.lock.Unlock() | ||||||
|  |  | ||||||
|  | 	if s.data == nil { | ||||||
|  | 		s.data = make(map[TKey]TData) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	rm := 0 | ||||||
|  | 	for k, v := range s.data { | ||||||
|  | 		if fn(k, v) { | ||||||
|  | 			delete(s.data, k) | ||||||
|  | 			rm++ | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return rm | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (s *SyncMap[TKey, TData]) Clear() { | ||||||
|  | 	s.lock.Lock() | ||||||
|  | 	defer s.lock.Unlock() | ||||||
|  |  | ||||||
|  | 	s.data = make(map[TKey]TData) | ||||||
|  | } | ||||||
|  |  | ||||||
| func (s *SyncMap[TKey, TData]) Contains(key TKey) bool { | func (s *SyncMap[TKey, TData]) Contains(key TKey) bool { | ||||||
| 	s.lock.Lock() | 	s.lock.Lock() | ||||||
| 	defer s.lock.Unlock() | 	defer s.lock.Unlock() | ||||||
| @@ -165,3 +191,14 @@ func (s *SyncMap[TKey, TData]) GetAllValues() []TData { | |||||||
|  |  | ||||||
| 	return r | 	return r | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func (s *SyncMap[TKey, TData]) Count() int { | ||||||
|  | 	s.lock.Lock() | ||||||
|  | 	defer s.lock.Unlock() | ||||||
|  |  | ||||||
|  | 	if s.data == nil { | ||||||
|  | 		s.data = make(map[TKey]TData) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return len(s.data) | ||||||
|  | } | ||||||
|   | |||||||
| @@ -5,12 +5,12 @@ import ( | |||||||
| 	"context" | 	"context" | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/dataext" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/enums" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"github.com/rs/zerolog" | 	"github.com/rs/zerolog" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/primitive" | 	"go.mongodb.org/mongo-driver/bson/primitive" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/dataext" |  | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/enums" |  | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"os" | 	"os" | ||||||
| 	"runtime/debug" | 	"runtime/debug" | ||||||
| @@ -319,6 +319,7 @@ func (b *Builder) GinReq(ctx context.Context, g *gin.Context, req *http.Request) | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	b.Str("gin_method", req.Method) | 	b.Str("gin_method", req.Method) | ||||||
|  | 	b.Str("gin_host", req.Host) | ||||||
| 	b.Str("gin_path", g.FullPath()) | 	b.Str("gin_path", g.FullPath()) | ||||||
| 	b.Strs("gin_header", extractHeader(g.Request.Header)) | 	b.Strs("gin_header", extractHeader(g.Request.Header)) | ||||||
| 	if req.URL != nil { | 	if req.URL != nil { | ||||||
| @@ -435,7 +436,7 @@ func (b *Builder) BuildAsExerr(ctxs ...context.Context) *ExErr { | |||||||
| 		b.errorData.ShortLog(pkgconfig.ZeroLogger.Error()) | 		b.errorData.ShortLog(pkgconfig.ZeroLogger.Error()) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	b.errorData.CallListener(MethodBuild) | 	b.errorData.CallListener(MethodBuild, ListenerOpt{NoLog: b.noLog}) | ||||||
|  |  | ||||||
| 	return b.errorData | 	return b.errorData | ||||||
| } | } | ||||||
| @@ -444,6 +445,8 @@ func (b *Builder) BuildAsExerr(ctxs ...context.Context) *ExErr { | |||||||
| // The error also gets printed to stdout/stderr | // The error also gets printed to stdout/stderr | ||||||
| // If the error is SevErr|SevFatal we also send it to the error-service | // If the error is SevErr|SevFatal we also send it to the error-service | ||||||
| func (b *Builder) Output(ctx context.Context, g *gin.Context) { | func (b *Builder) Output(ctx context.Context, g *gin.Context) { | ||||||
|  | 	warnOnPkgConfigNotInitialized() | ||||||
|  |  | ||||||
| 	if !b.containsGinData && g.Request != nil { | 	if !b.containsGinData && g.Request != nil { | ||||||
| 		// Auto-Add gin metadata if the caller hasn't already done it | 		// Auto-Add gin metadata if the caller hasn't already done it | ||||||
| 		b.GinReq(ctx, g, g.Request) | 		b.GinReq(ctx, g, g.Request) | ||||||
| @@ -451,6 +454,12 @@ func (b *Builder) Output(ctx context.Context, g *gin.Context) { | |||||||
|  |  | ||||||
| 	b.CtxData(MethodOutput, ctx) | 	b.CtxData(MethodOutput, ctx) | ||||||
|  |  | ||||||
|  | 	// this is only here to add one level to the trace | ||||||
|  | 	// so that .Build() and .Output() and .Print() have the same depth and our stack-skip logger can have the same skip-count | ||||||
|  | 	b.doOutput(ctx, g) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (b *Builder) doOutput(ctx context.Context, g *gin.Context) { | ||||||
| 	b.errorData.Output(g) | 	b.errorData.Output(g) | ||||||
|  |  | ||||||
| 	if (b.errorData.Severity == SevErr || b.errorData.Severity == SevFatal) && (pkgconfig.ZeroLogErrGinOutput || pkgconfig.ZeroLogAllGinOutput) { | 	if (b.errorData.Severity == SevErr || b.errorData.Severity == SevFatal) && (pkgconfig.ZeroLogErrGinOutput || pkgconfig.ZeroLogAllGinOutput) { | ||||||
| @@ -459,7 +468,7 @@ func (b *Builder) Output(ctx context.Context, g *gin.Context) { | |||||||
| 		b.errorData.Log(pkgconfig.ZeroLogger.Warn()) | 		b.errorData.Log(pkgconfig.ZeroLogger.Warn()) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	b.errorData.CallListener(MethodOutput) | 	b.errorData.CallListener(MethodOutput, ListenerOpt{NoLog: b.noLog}) | ||||||
| } | } | ||||||
|  |  | ||||||
| // Print prints the error | // Print prints the error | ||||||
| @@ -471,6 +480,12 @@ func (b *Builder) Print(ctxs ...context.Context) Proxy { | |||||||
| 		b.CtxData(MethodPrint, dctx) | 		b.CtxData(MethodPrint, dctx) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	// this is only here to add one level to the trace | ||||||
|  | 	// so that .Build() and .Output() and .Print() have the same depth and our stack-skip logger can have the same skip-count | ||||||
|  | 	return b.doPrint() | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (b *Builder) doPrint() Proxy { | ||||||
| 	if b.errorData.Severity == SevErr || b.errorData.Severity == SevFatal { | 	if b.errorData.Severity == SevErr || b.errorData.Severity == SevFatal { | ||||||
| 		b.errorData.Log(pkgconfig.ZeroLogger.Error()) | 		b.errorData.Log(pkgconfig.ZeroLogger.Error()) | ||||||
| 	} else if b.errorData.Severity == SevWarn { | 	} else if b.errorData.Severity == SevWarn { | ||||||
| @@ -481,7 +496,7 @@ func (b *Builder) Print(ctxs ...context.Context) Proxy { | |||||||
| 		b.errorData.ShortLog(pkgconfig.ZeroLogger.Debug()) | 		b.errorData.ShortLog(pkgconfig.ZeroLogger.Debug()) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	b.errorData.CallListener(MethodPrint) | 	b.errorData.CallListener(MethodPrint, ListenerOpt{NoLog: b.noLog}) | ||||||
|  |  | ||||||
| 	return Proxy{v: *b.errorData} // we return Proxy<Exerr> here instead of Exerr to prevent warnings on ignored err-returns | 	return Proxy{v: *b.errorData} // we return Proxy<Exerr> here instead of Exerr to prevent warnings on ignored err-returns | ||||||
| } | } | ||||||
| @@ -500,13 +515,19 @@ func (b *Builder) Fatal(ctxs ...context.Context) { | |||||||
| 		b.CtxData(MethodFatal, dctx) | 		b.CtxData(MethodFatal, dctx) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	b.errorData.Log(pkgconfig.ZeroLogger.WithLevel(zerolog.FatalLevel)) | 	// this is only here to add one level to the trace | ||||||
|  | 	// so that .Build() and .Output() and .Print() have the same depth and our stack-skip logger can have the same skip-count | ||||||
|  | 	b.doLogFatal() | ||||||
|  |  | ||||||
| 	b.errorData.CallListener(MethodFatal) | 	b.errorData.CallListener(MethodFatal, ListenerOpt{NoLog: b.noLog}) | ||||||
|  |  | ||||||
| 	os.Exit(1) | 	os.Exit(1) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func (b *Builder) doLogFatal() { | ||||||
|  | 	b.errorData.Log(pkgconfig.ZeroLogger.WithLevel(zerolog.FatalLevel)) | ||||||
|  | } | ||||||
|  |  | ||||||
| // ---------------------------------------------------------------------------- | // ---------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| func (b *Builder) addMeta(key string, mdtype metaDataType, val interface{}) *Builder { | func (b *Builder) addMeta(key string, mdtype metaDataType, val interface{}) *Builder { | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/primitive" | 	"go.mongodb.org/mongo-driver/bson/primitive" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -8,8 +8,8 @@ import ( | |||||||
| 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsonrw" | 	"go.mongodb.org/mongo-driver/bson/bsonrw" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsontype" | 	"go.mongodb.org/mongo-driver/bson/bsontype" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/dataext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/dataext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ import ( | |||||||
| 	"go.mongodb.org/mongo-driver/bson" | 	"go.mongodb.org/mongo-driver/bson" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/primitive" | 	"go.mongodb.org/mongo-driver/bson/primitive" | ||||||
| 	"go.mongodb.org/mongo-driver/mongo" | 	"go.mongodb.org/mongo-driver/mongo" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -3,9 +3,9 @@ package exerr | |||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"github.com/rs/zerolog" | 	"github.com/rs/zerolog" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"os" | 	"os" | ||||||
| ) | ) | ||||||
| @@ -119,7 +119,7 @@ func newDefaultLogger() zerolog.Logger { | |||||||
|  |  | ||||||
| 	multi := zerolog.MultiLevelWriter(cw) | 	multi := zerolog.MultiLevelWriter(cw) | ||||||
|  |  | ||||||
| 	return zerolog.New(multi).With().Timestamp().CallerWithSkipFrameCount(4).Logger() | 	return zerolog.New(multi).With().Timestamp().CallerWithSkipFrameCount(5).Logger() | ||||||
| } | } | ||||||
|  |  | ||||||
| func Initialized() bool { | func Initialized() bool { | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/rs/xid" | 	"github.com/rs/xid" | ||||||
| 	"github.com/rs/zerolog" | 	"github.com/rs/zerolog" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
| @@ -371,7 +371,7 @@ func (ee *ExErr) GetExtra(key string) (any, bool) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (ee *ExErr) UniqueIDs() []string { | func (ee *ExErr) UniqueIDs() []string { | ||||||
| 	ids := []string{ee.UniqueID} | 	ids := make([]string, 0, 1) | ||||||
| 	for curr := ee; curr != nil; curr = curr.OriginalError { | 	for curr := ee; curr != nil; curr = curr.OriginalError { | ||||||
| 		ids = append(ids, curr.UniqueID) | 		ids = append(ids, curr.UniqueID) | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ package exerr | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"os" | 	"os" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ package exerr | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	json "gogs.mikescher.com/BlackForestBytes/goext/gojson" | 	json "git.blackforestbytes.com/BlackForestBytes/goext/gojson" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -4,7 +4,11 @@ import ( | |||||||
| 	"sync" | 	"sync" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type Listener = func(method Method, v *ExErr) | type ListenerOpt struct { | ||||||
|  | 	NoLog bool | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type Listener = func(method Method, v *ExErr, opt ListenerOpt) | ||||||
|  |  | ||||||
| var listenerLock = sync.Mutex{} | var listenerLock = sync.Mutex{} | ||||||
| var listener = make([]Listener, 0) | var listener = make([]Listener, 0) | ||||||
| @@ -16,11 +20,11 @@ func RegisterListener(l Listener) { | |||||||
| 	listener = append(listener, l) | 	listener = append(listener, l) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (ee *ExErr) CallListener(m Method) { | func (ee *ExErr) CallListener(m Method, opt ListenerOpt) { | ||||||
| 	listenerLock.Lock() | 	listenerLock.Lock() | ||||||
| 	defer listenerLock.Unlock() | 	defer listenerLock.Unlock() | ||||||
|  |  | ||||||
| 	for _, v := range listener { | 	for _, v := range listener { | ||||||
| 		v(m, ee) | 		v(m, ee, opt) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,10 +5,10 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"github.com/rs/zerolog" | 	"github.com/rs/zerolog" | ||||||
| 	"go.mongodb.org/mongo-driver/bson" | 	"go.mongodb.org/mongo-driver/bson" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/primitive" | 	"go.mongodb.org/mongo-driver/bson/primitive" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"math" | 	"math" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
| @@ -720,6 +720,9 @@ func (mm MetaMap) FormatMultiLine(indentFront string, indentKeys string, maxLenV | |||||||
| 		if key == "gin.body" { | 		if key == "gin.body" { | ||||||
| 			continue | 			continue | ||||||
| 		} | 		} | ||||||
|  | 		if key == "gin_body" { | ||||||
|  | 			continue | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		r += indentFront | 		r += indentFront | ||||||
| 		r += indentKeys | 		r += indentKeys | ||||||
|   | |||||||
| @@ -4,8 +4,8 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/rs/zerolog/log" | 	"github.com/rs/zerolog/log" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/enums" | 	"git.blackforestbytes.com/BlackForestBytes/goext/enums" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"strings" | 	"strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package ginext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/dataext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/dataext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func BodyBuffer(g *gin.Context) { | func BodyBuffer(g *gin.Context) { | ||||||
|   | |||||||
| @@ -4,9 +4,9 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"github.com/rs/zerolog/log" | 	"github.com/rs/zerolog/log" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/mathext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/mathext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/rext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/rext" | ||||||
| 	"net" | 	"net" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"net/http/httptest" | 	"net/http/httptest" | ||||||
|   | |||||||
| @@ -2,8 +2,9 @@ package ginext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"net/http" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type WHandlerFunc func(PreContext) HTTPResponse | type WHandlerFunc func(PreContext) HTTPResponse | ||||||
| @@ -58,3 +59,31 @@ func Wrap(w *GinWrapper, fn WHandlerFunc) gin.HandlerFunc { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func WrapHTTPHandler(w *GinWrapper, fn http.Handler) gin.HandlerFunc { | ||||||
|  | 	return func(g *gin.Context) { | ||||||
|  | 		for _, lstr := range w.listenerBeforeRequest { | ||||||
|  | 			lstr(g) | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		fn.ServeHTTP(g.Writer, g.Request) | ||||||
|  |  | ||||||
|  | 		for _, lstr := range w.listenerAfterRequest { | ||||||
|  | 			lstr(g, nil) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func WrapHTTPHandlerFunc(w *GinWrapper, fn http.HandlerFunc) gin.HandlerFunc { | ||||||
|  | 	return func(g *gin.Context) { | ||||||
|  | 		for _, lstr := range w.listenerBeforeRequest { | ||||||
|  | 			lstr(g) | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		fn(g.Writer, g.Request) | ||||||
|  |  | ||||||
|  | 		for _, lstr := range w.listenerAfterRequest { | ||||||
|  | 			lstr(g, nil) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|   | |||||||
| @@ -6,9 +6,9 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"github.com/gin-gonic/gin/binding" | 	"github.com/gin-gonic/gin/binding" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/dataext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/dataext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"io" | 	"io" | ||||||
| 	"runtime/debug" | 	"runtime/debug" | ||||||
| 	"time" | 	"time" | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package ginext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type cookieval struct { | type cookieval struct { | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package ginext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type dataHTTPResponse struct { | type dataHTTPResponse struct { | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ package ginext | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type downloadDataHTTPResponse struct { | type downloadDataHTTPResponse struct { | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package ginext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type emptyHTTPResponse struct { | type emptyHTTPResponse struct { | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ package ginext | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"os" | 	"os" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ package ginext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	json "gogs.mikescher.com/BlackForestBytes/goext/gojson" | 	json "git.blackforestbytes.com/BlackForestBytes/goext/gojson" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type jsonHTTPResponse struct { | type jsonHTTPResponse struct { | ||||||
|   | |||||||
| @@ -3,8 +3,8 @@ package ginext | |||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type jsonAPIErrResponse struct { | type jsonAPIErrResponse struct { | ||||||
| @@ -27,7 +27,7 @@ func (j jsonAPIErrResponse) Write(g *gin.Context) { | |||||||
|  |  | ||||||
| 	exerr.Get(j.err).Output(context.Background(), g) | 	exerr.Get(j.err).Output(context.Background(), g) | ||||||
|  |  | ||||||
| 	j.err.CallListener(exerr.MethodOutput) | 	j.err.CallListener(exerr.MethodOutput, exerr.ListenerOpt{NoLog: false}) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (j jsonAPIErrResponse) WithHeader(k string, v string) HTTPResponse { | func (j jsonAPIErrResponse) WithHeader(k string, v string) HTTPResponse { | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package ginext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type redirectHTTPResponse struct { | type redirectHTTPResponse struct { | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ package ginext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"io" | 	"io" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"time" | 	"time" | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package ginext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type textHTTPResponse struct { | type textHTTPResponse struct { | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| package ginext | package ginext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"github.com/gin-gonic/gin" | 	"github.com/gin-gonic/gin" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"path" | 	"path" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| @@ -148,6 +148,68 @@ func (w *GinRouteBuilder) Handle(handler WHandlerFunc) { | |||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func (w *GinRouteBuilder) HandleRawHTTPHandler(f http.Handler) { | ||||||
|  | 	if w.routes.wrapper.bufferBody { | ||||||
|  | 		arr := make([]gin.HandlerFunc, 0, len(w.handlers)+1) | ||||||
|  | 		arr = append(arr, BodyBuffer) | ||||||
|  | 		arr = append(arr, w.handlers...) | ||||||
|  | 		w.handlers = arr | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	middlewareNames := langext.ArrMap(w.handlers, func(v gin.HandlerFunc) string { return nameOfFunction(v) }) | ||||||
|  |  | ||||||
|  | 	w.handlers = append(w.handlers, WrapHTTPHandler(w.routes.wrapper, f)) | ||||||
|  |  | ||||||
|  | 	methodName := w.method | ||||||
|  |  | ||||||
|  | 	if w.method == "*" { | ||||||
|  | 		methodName = "ANY" | ||||||
|  | 		for _, method := range anyMethods { | ||||||
|  | 			w.routes.routes.Handle(method, w.relPath, w.handlers...) | ||||||
|  | 		} | ||||||
|  | 	} else { | ||||||
|  | 		w.routes.routes.Handle(w.method, w.relPath, w.handlers...) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	w.routes.wrapper.routeSpecs = append(w.routes.wrapper.routeSpecs, ginRouteSpec{ | ||||||
|  | 		Method:      methodName, | ||||||
|  | 		URL:         w.absPath, | ||||||
|  | 		Middlewares: middlewareNames, | ||||||
|  | 		Handler:     "[HTTPHandler]", | ||||||
|  | 	}) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (w *GinRouteBuilder) HandleRawHTTPHandlerFunc(f http.HandlerFunc) { | ||||||
|  | 	if w.routes.wrapper.bufferBody { | ||||||
|  | 		arr := make([]gin.HandlerFunc, 0, len(w.handlers)+1) | ||||||
|  | 		arr = append(arr, BodyBuffer) | ||||||
|  | 		arr = append(arr, w.handlers...) | ||||||
|  | 		w.handlers = arr | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	middlewareNames := langext.ArrMap(w.handlers, func(v gin.HandlerFunc) string { return nameOfFunction(v) }) | ||||||
|  |  | ||||||
|  | 	w.handlers = append(w.handlers, WrapHTTPHandlerFunc(w.routes.wrapper, f)) | ||||||
|  |  | ||||||
|  | 	methodName := w.method | ||||||
|  |  | ||||||
|  | 	if w.method == "*" { | ||||||
|  | 		methodName = "ANY" | ||||||
|  | 		for _, method := range anyMethods { | ||||||
|  | 			w.routes.routes.Handle(method, w.relPath, w.handlers...) | ||||||
|  | 		} | ||||||
|  | 	} else { | ||||||
|  | 		w.routes.routes.Handle(w.method, w.relPath, w.handlers...) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	w.routes.wrapper.routeSpecs = append(w.routes.wrapper.routeSpecs, ginRouteSpec{ | ||||||
|  | 		Method:      methodName, | ||||||
|  | 		URL:         w.absPath, | ||||||
|  | 		Middlewares: middlewareNames, | ||||||
|  | 		Handler:     "[HTTPHandlerFunc]", | ||||||
|  | 	}) | ||||||
|  | } | ||||||
|  |  | ||||||
| func (w *GinWrapper) NoRoute(handler WHandlerFunc) { | func (w *GinWrapper) NoRoute(handler WHandlerFunc) { | ||||||
|  |  | ||||||
| 	handlers := make([]gin.HandlerFunc, 0) | 	handlers := make([]gin.HandlerFunc, 0) | ||||||
|   | |||||||
							
								
								
									
										44
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								go.mod
									
									
									
									
									
								
							| @@ -1,63 +1,63 @@ | |||||||
| module gogs.mikescher.com/BlackForestBytes/goext | module git.blackforestbytes.com/BlackForestBytes/goext | ||||||
|  |  | ||||||
| go 1.23.0 | go 1.23.0 | ||||||
|  |  | ||||||
| toolchain go1.24.0 | toolchain go1.24.0 | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/gin-gonic/gin v1.10.0 | 	github.com/gin-gonic/gin v1.10.1 | ||||||
| 	github.com/glebarez/go-sqlite v1.22.0 // only needed for tests -.- | 	github.com/glebarez/go-sqlite v1.22.0 // only needed for tests -.- | ||||||
| 	github.com/jmoiron/sqlx v1.4.0 | 	github.com/jmoiron/sqlx v1.4.0 | ||||||
| 	github.com/rs/xid v1.6.0 | 	github.com/rs/xid v1.6.0 | ||||||
| 	github.com/rs/zerolog v1.33.0 | 	github.com/rs/zerolog v1.34.0 | ||||||
| 	go.mongodb.org/mongo-driver v1.17.3 | 	go.mongodb.org/mongo-driver v1.17.4 | ||||||
| 	golang.org/x/crypto v0.35.0 | 	golang.org/x/crypto v0.40.0 | ||||||
| 	golang.org/x/sys v0.30.0 | 	golang.org/x/sys v0.34.0 | ||||||
| 	golang.org/x/term v0.29.0 | 	golang.org/x/term v0.33.0 | ||||||
| ) | ) | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/disintegration/imaging v1.6.2 | 	github.com/disintegration/imaging v1.6.2 | ||||||
| 	github.com/jung-kurt/gofpdf v1.16.2 | 	github.com/jung-kurt/gofpdf v1.16.2 | ||||||
| 	golang.org/x/sync v0.11.0 | 	golang.org/x/net v0.42.0 | ||||||
|  | 	golang.org/x/sync v0.16.0 | ||||||
| ) | ) | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/bytedance/sonic v1.12.9 // indirect | 	github.com/bytedance/sonic v1.13.3 // indirect | ||||||
| 	github.com/bytedance/sonic/loader v0.2.3 // indirect | 	github.com/bytedance/sonic/loader v0.3.0 // indirect | ||||||
| 	github.com/cloudwego/base64x v0.1.5 // indirect | 	github.com/cloudwego/base64x v0.1.5 // indirect | ||||||
| 	github.com/cloudwego/iasm v0.2.0 // indirect | 	github.com/cloudwego/iasm v0.2.0 // indirect | ||||||
| 	github.com/dustin/go-humanize v1.0.1 // indirect | 	github.com/dustin/go-humanize v1.0.1 // indirect | ||||||
| 	github.com/gabriel-vasile/mimetype v1.4.8 // indirect | 	github.com/gabriel-vasile/mimetype v1.4.9 // indirect | ||||||
| 	github.com/gin-contrib/sse v1.0.0 // indirect | 	github.com/gin-contrib/sse v1.1.0 // indirect | ||||||
| 	github.com/go-playground/locales v0.14.1 // indirect | 	github.com/go-playground/locales v0.14.1 // indirect | ||||||
| 	github.com/go-playground/universal-translator v0.18.1 // indirect | 	github.com/go-playground/universal-translator v0.18.1 // indirect | ||||||
| 	github.com/go-playground/validator/v10 v10.25.0 // indirect | 	github.com/go-playground/validator/v10 v10.27.0 // indirect | ||||||
| 	github.com/goccy/go-json v0.10.5 // indirect | 	github.com/goccy/go-json v0.10.5 // indirect | ||||||
| 	github.com/golang/snappy v0.0.4 // indirect | 	github.com/golang/snappy v1.0.0 // indirect | ||||||
| 	github.com/google/uuid v1.5.0 // indirect | 	github.com/google/uuid v1.5.0 // indirect | ||||||
| 	github.com/json-iterator/go v1.1.12 // indirect | 	github.com/json-iterator/go v1.1.12 // indirect | ||||||
| 	github.com/klauspost/compress v1.18.0 // indirect | 	github.com/klauspost/compress v1.18.0 // indirect | ||||||
| 	github.com/klauspost/cpuid/v2 v2.2.10 // indirect | 	github.com/klauspost/cpuid/v2 v2.3.0 // indirect | ||||||
| 	github.com/leodido/go-urn v1.4.0 // indirect | 	github.com/leodido/go-urn v1.4.0 // indirect | ||||||
| 	github.com/mattn/go-colorable v0.1.14 // indirect | 	github.com/mattn/go-colorable v0.1.14 // indirect | ||||||
| 	github.com/mattn/go-isatty v0.0.20 // indirect | 	github.com/mattn/go-isatty v0.0.20 // indirect | ||||||
| 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||||||
| 	github.com/modern-go/reflect2 v1.0.2 // indirect | 	github.com/modern-go/reflect2 v1.0.2 // indirect | ||||||
| 	github.com/montanaflynn/stats v0.7.1 // indirect | 	github.com/montanaflynn/stats v0.7.1 // indirect | ||||||
| 	github.com/pelletier/go-toml/v2 v2.2.3 // indirect | 	github.com/pelletier/go-toml/v2 v2.2.4 // indirect | ||||||
| 	github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect | 	github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect | ||||||
| 	github.com/twitchyliquid64/golang-asm v0.15.1 // indirect | 	github.com/twitchyliquid64/golang-asm v0.15.1 // indirect | ||||||
| 	github.com/ugorji/go/codec v1.2.12 // indirect | 	github.com/ugorji/go/codec v1.3.0 // indirect | ||||||
| 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect | 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect | ||||||
| 	github.com/xdg-go/scram v1.1.2 // indirect | 	github.com/xdg-go/scram v1.1.2 // indirect | ||||||
| 	github.com/xdg-go/stringprep v1.0.4 // indirect | 	github.com/xdg-go/stringprep v1.0.4 // indirect | ||||||
| 	github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect | 	github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect | ||||||
| 	golang.org/x/arch v0.14.0 // indirect | 	golang.org/x/arch v0.19.0 // indirect | ||||||
| 	golang.org/x/image v0.24.0 // indirect | 	golang.org/x/image v0.29.0 // indirect | ||||||
| 	golang.org/x/net v0.35.0 // indirect | 	golang.org/x/text v0.27.0 // indirect | ||||||
| 	golang.org/x/text v0.22.0 // indirect | 	google.golang.org/protobuf v1.36.6 // indirect | ||||||
| 	google.golang.org/protobuf v1.36.5 // indirect |  | ||||||
| 	gopkg.in/yaml.v3 v3.0.1 // indirect | 	gopkg.in/yaml.v3 v3.0.1 // indirect | ||||||
| 	modernc.org/libc v1.37.6 // indirect | 	modernc.org/libc v1.37.6 // indirect | ||||||
| 	modernc.org/mathutil v1.6.0 // indirect | 	modernc.org/mathutil v1.6.0 // indirect | ||||||
|   | |||||||
							
								
								
									
										118
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										118
									
								
								go.sum
									
									
									
									
									
								
							| @@ -15,6 +15,14 @@ github.com/bytedance/sonic v1.12.8 h1:4xYRVRlXIgvSZ4e8iVTlMF5szgpXd4AfvuWgA8I8lg | |||||||
| github.com/bytedance/sonic v1.12.8/go.mod h1:uVvFidNmlt9+wa31S1urfwwthTWteBgG0hWuoKAXTx8= | github.com/bytedance/sonic v1.12.8/go.mod h1:uVvFidNmlt9+wa31S1urfwwthTWteBgG0hWuoKAXTx8= | ||||||
| github.com/bytedance/sonic v1.12.9 h1:Od1BvK55NnewtGaJsTDeAOSnLVO2BTSLOe0+ooKokmQ= | github.com/bytedance/sonic v1.12.9 h1:Od1BvK55NnewtGaJsTDeAOSnLVO2BTSLOe0+ooKokmQ= | ||||||
| github.com/bytedance/sonic v1.12.9/go.mod h1:uVvFidNmlt9+wa31S1urfwwthTWteBgG0hWuoKAXTx8= | github.com/bytedance/sonic v1.12.9/go.mod h1:uVvFidNmlt9+wa31S1urfwwthTWteBgG0hWuoKAXTx8= | ||||||
|  | github.com/bytedance/sonic v1.12.10 h1:uVCQr6oS5669E9ZVW0HyksTLfNS7Q/9hV6IVS4nEMsI= | ||||||
|  | github.com/bytedance/sonic v1.12.10/go.mod h1:uVvFidNmlt9+wa31S1urfwwthTWteBgG0hWuoKAXTx8= | ||||||
|  | github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g= | ||||||
|  | github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= | ||||||
|  | github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ= | ||||||
|  | github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= | ||||||
|  | github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0= | ||||||
|  | github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= | ||||||
| github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= | github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= | ||||||
| github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= | github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= | ||||||
| github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= | github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= | ||||||
| @@ -24,6 +32,10 @@ github.com/bytedance/sonic/loader v0.2.2 h1:jxAJuN9fOot/cyz5Q6dUuMJF5OqQ6+5GfA8F | |||||||
| github.com/bytedance/sonic/loader v0.2.2/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= | github.com/bytedance/sonic/loader v0.2.2/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= | ||||||
| github.com/bytedance/sonic/loader v0.2.3 h1:yctD0Q3v2NOGfSWPLPvG2ggA2kV6TS6s4wioyEqssH0= | github.com/bytedance/sonic/loader v0.2.3 h1:yctD0Q3v2NOGfSWPLPvG2ggA2kV6TS6s4wioyEqssH0= | ||||||
| github.com/bytedance/sonic/loader v0.2.3/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= | github.com/bytedance/sonic/loader v0.2.3/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= | ||||||
|  | github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= | ||||||
|  | github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= | ||||||
|  | github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA= | ||||||
|  | github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= | ||||||
| github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= | github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= | ||||||
| github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= | github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= | ||||||
| github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= | github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= | ||||||
| @@ -46,12 +58,18 @@ github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW | |||||||
| github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU= | github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU= | ||||||
| github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= | github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= | ||||||
| github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= | github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= | ||||||
|  | github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= | ||||||
|  | github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= | ||||||
| github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= | github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= | ||||||
| github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= | github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= | ||||||
| github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E= | github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E= | ||||||
| github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0= | github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0= | ||||||
|  | github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= | ||||||
|  | github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= | ||||||
| github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= | github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= | ||||||
| github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= | github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= | ||||||
|  | github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ= | ||||||
|  | github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= | ||||||
| github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ= | github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ= | ||||||
| github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= | github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= | ||||||
| github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= | github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= | ||||||
| @@ -68,6 +86,10 @@ github.com/go-playground/validator/v10 v10.24.0 h1:KHQckvo8G6hlWnrPX4NJJ+aBfWNAE | |||||||
| github.com/go-playground/validator/v10 v10.24.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus= | github.com/go-playground/validator/v10 v10.24.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus= | ||||||
| github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8= | github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8= | ||||||
| github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus= | github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus= | ||||||
|  | github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= | ||||||
|  | github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= | ||||||
|  | github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4= | ||||||
|  | github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= | ||||||
| github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= | github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= | ||||||
| github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= | github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= | ||||||
| github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= | github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= | ||||||
| @@ -79,6 +101,8 @@ github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PU | |||||||
| github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= | github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= | ||||||
| github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= | github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= | ||||||
| github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= | github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= | ||||||
|  | github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= | ||||||
|  | github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= | ||||||
| github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= | ||||||
| github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | ||||||
| github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= | ||||||
| @@ -106,6 +130,10 @@ github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kK | |||||||
| github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= | github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= | ||||||
| github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= | github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= | ||||||
| github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= | github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= | ||||||
|  | github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU= | ||||||
|  | github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= | ||||||
|  | github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= | ||||||
|  | github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= | ||||||
| github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= | github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= | ||||||
| github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= | github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= | ||||||
| github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= | github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= | ||||||
| @@ -130,6 +158,8 @@ github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8 | |||||||
| github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= | github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= | ||||||
| github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= | github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= | ||||||
| github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= | github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= | ||||||
|  | github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= | ||||||
|  | github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= | ||||||
| github.com/phpdave11/gofpdi v1.0.7/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= | github.com/phpdave11/gofpdi v1.0.7/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= | ||||||
| github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||||||
| github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||||||
| @@ -142,6 +172,8 @@ github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= | |||||||
| github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= | github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= | ||||||
| github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= | github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= | ||||||
| github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= | github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= | ||||||
|  | github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= | ||||||
|  | github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= | ||||||
| github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= | github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= | ||||||
| github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||||||
| github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= | ||||||
| @@ -161,6 +193,10 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS | |||||||
| github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= | github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= | ||||||
| github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= | github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= | ||||||
| github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= | github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= | ||||||
|  | github.com/ugorji/go/codec v1.2.14 h1:yOQvXCBc3Ij46LRkRoh4Yd5qK6LVOgi0bYOXfb7ifjw= | ||||||
|  | github.com/ugorji/go/codec v1.2.14/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= | ||||||
|  | github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= | ||||||
|  | github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= | ||||||
| github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= | github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= | ||||||
| github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= | github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= | ||||||
| github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= | github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= | ||||||
| @@ -176,6 +212,8 @@ go.mongodb.org/mongo-driver v1.17.2 h1:gvZyk8352qSfzyZ2UMWcpDpMSGEr1eqE4T793Sqyh | |||||||
| go.mongodb.org/mongo-driver v1.17.2/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= | go.mongodb.org/mongo-driver v1.17.2/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= | ||||||
| go.mongodb.org/mongo-driver v1.17.3 h1:TQyXhnsWfWtgAhMtOgtYHMTkZIfBTpMTsMnd9ZBeHxQ= | go.mongodb.org/mongo-driver v1.17.3 h1:TQyXhnsWfWtgAhMtOgtYHMTkZIfBTpMTsMnd9ZBeHxQ= | ||||||
| go.mongodb.org/mongo-driver v1.17.3/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= | go.mongodb.org/mongo-driver v1.17.3/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= | ||||||
|  | go.mongodb.org/mongo-driver v1.17.4 h1:jUorfmVzljjr0FLzYQsGP8cgN/qzzxlY9Vh0C9KFXVw= | ||||||
|  | go.mongodb.org/mongo-driver v1.17.4/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= | ||||||
| golang.org/x/arch v0.11.0 h1:KXV8WWKCXm6tRpLirl2szsO5j/oOODwZf4hATmGVNs4= | golang.org/x/arch v0.11.0 h1:KXV8WWKCXm6tRpLirl2szsO5j/oOODwZf4hATmGVNs4= | ||||||
| golang.org/x/arch v0.11.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= | golang.org/x/arch v0.11.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= | ||||||
| golang.org/x/arch v0.12.0 h1:UsYJhbzPYGsT0HbEdmYcqtCv8UNGvnaL561NnIUvaKg= | golang.org/x/arch v0.12.0 h1:UsYJhbzPYGsT0HbEdmYcqtCv8UNGvnaL561NnIUvaKg= | ||||||
| @@ -184,6 +222,16 @@ golang.org/x/arch v0.13.0 h1:KCkqVVV1kGg0X87TFysjCJ8MxtZEIU4Ja/yXGeoECdA= | |||||||
| golang.org/x/arch v0.13.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= | golang.org/x/arch v0.13.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= | ||||||
| golang.org/x/arch v0.14.0 h1:z9JUEZWr8x4rR0OU6c4/4t6E6jOZ8/QBS2bBYBm4tx4= | golang.org/x/arch v0.14.0 h1:z9JUEZWr8x4rR0OU6c4/4t6E6jOZ8/QBS2bBYBm4tx4= | ||||||
| golang.org/x/arch v0.14.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= | golang.org/x/arch v0.14.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= | ||||||
|  | golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw= | ||||||
|  | golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE= | ||||||
|  | golang.org/x/arch v0.16.0 h1:foMtLTdyOmIniqWCHjY6+JxuC54XP1fDwx4N0ASyW+U= | ||||||
|  | golang.org/x/arch v0.16.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE= | ||||||
|  | golang.org/x/arch v0.17.0 h1:4O3dfLzd+lQewptAHqjewQZQDyEdejz3VwgeYwkZneU= | ||||||
|  | golang.org/x/arch v0.17.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= | ||||||
|  | golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc= | ||||||
|  | golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= | ||||||
|  | golang.org/x/arch v0.19.0 h1:LmbDQUodHThXE+htjrnmVD73M//D9GTH6wFZjyDkjyU= | ||||||
|  | golang.org/x/arch v0.19.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= | ||||||
| golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||||||
| golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | ||||||
| golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= | golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= | ||||||
| @@ -200,6 +248,16 @@ golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= | |||||||
| golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= | golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= | ||||||
| golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs= | golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs= | ||||||
| golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= | golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= | ||||||
|  | golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= | ||||||
|  | golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= | ||||||
|  | golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= | ||||||
|  | golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= | ||||||
|  | golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= | ||||||
|  | golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= | ||||||
|  | golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= | ||||||
|  | golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= | ||||||
|  | golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= | ||||||
|  | golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= | ||||||
| golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= | golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= | ||||||
| golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= | golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= | ||||||
| golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s= | golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s= | ||||||
| @@ -210,6 +268,16 @@ golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68= | |||||||
| golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY= | golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY= | ||||||
| golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ= | golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ= | ||||||
| golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8= | golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8= | ||||||
|  | golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ= | ||||||
|  | golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs= | ||||||
|  | golang.org/x/image v0.26.0 h1:4XjIFEZWQmCZi6Wv8BoxsDhRU3RVnLX04dToTDAEPlY= | ||||||
|  | golang.org/x/image v0.26.0/go.mod h1:lcxbMFAovzpnJxzXS3nyL83K27tmqtKzIJpctK8YO5c= | ||||||
|  | golang.org/x/image v0.27.0 h1:C8gA4oWU/tKkdCfYT6T2u4faJu3MeNS5O8UPWlPF61w= | ||||||
|  | golang.org/x/image v0.27.0/go.mod h1:xbdrClrAUway1MUTEZDq9mz/UpRwYAkFFNUslZtcB+g= | ||||||
|  | golang.org/x/image v0.28.0 h1:gdem5JW1OLS4FbkWgLO+7ZeFzYtL3xClb97GaUzYMFE= | ||||||
|  | golang.org/x/image v0.28.0/go.mod h1:GUJYXtnGKEUgggyzh+Vxt+AviiCcyiwpsl8iQ8MvwGY= | ||||||
|  | golang.org/x/image v0.29.0 h1:HcdsyR4Gsuys/Axh0rDEmlBmB68rW1U9BUdB3UVHsas= | ||||||
|  | golang.org/x/image v0.29.0/go.mod h1:RVJROnf3SLK8d26OW91j4FrIHGbsJ8QnbEocVTOWQDA= | ||||||
| golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= | ||||||
| golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||||
| golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= | ||||||
| @@ -226,6 +294,18 @@ golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= | |||||||
| golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= | golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= | ||||||
| golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= | golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= | ||||||
| golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= | golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= | ||||||
|  | golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= | ||||||
|  | golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= | ||||||
|  | golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= | ||||||
|  | golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= | ||||||
|  | golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= | ||||||
|  | golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= | ||||||
|  | golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= | ||||||
|  | golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= | ||||||
|  | golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= | ||||||
|  | golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= | ||||||
|  | golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= | ||||||
|  | golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= | ||||||
| golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= | golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= | ||||||
| @@ -236,6 +316,16 @@ golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= | |||||||
| golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= | golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= | ||||||
| golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= | golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= | ||||||
| golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= | golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= | ||||||
|  | golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= | ||||||
|  | golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= | ||||||
|  | golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= | ||||||
|  | golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= | ||||||
|  | golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= | ||||||
|  | golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= | ||||||
|  | golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= | ||||||
|  | golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= | ||||||
|  | golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= | ||||||
|  | golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= | ||||||
| golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
| @@ -255,6 +345,14 @@ golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= | |||||||
| golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||||||
| golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= | golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= | ||||||
| golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||||||
|  | golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= | ||||||
|  | golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= | ||||||
|  | golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= | ||||||
|  | golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= | ||||||
|  | golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= | ||||||
|  | golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= | ||||||
|  | golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= | ||||||
|  | golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= | ||||||
| golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | ||||||
| golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= | ||||||
| golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= | golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= | ||||||
| @@ -267,6 +365,14 @@ golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= | |||||||
| golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= | golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= | ||||||
| golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= | golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= | ||||||
| golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= | golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= | ||||||
|  | golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= | ||||||
|  | golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= | ||||||
|  | golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o= | ||||||
|  | golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw= | ||||||
|  | golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= | ||||||
|  | golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= | ||||||
|  | golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= | ||||||
|  | golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= | ||||||
| golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||||||
| golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||||||
| golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= | ||||||
| @@ -279,6 +385,16 @@ golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= | |||||||
| golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= | golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= | ||||||
| golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= | golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= | ||||||
| golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= | golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= | ||||||
|  | golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= | ||||||
|  | golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= | ||||||
|  | golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= | ||||||
|  | golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= | ||||||
|  | golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= | ||||||
|  | golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= | ||||||
|  | golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= | ||||||
|  | golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= | ||||||
|  | golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= | ||||||
|  | golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= | ||||||
| golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
| golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | ||||||
| golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= | ||||||
| @@ -297,6 +413,8 @@ google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNI | |||||||
| google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= | google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= | ||||||
| google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= | google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= | ||||||
| google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= | google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= | ||||||
|  | google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= | ||||||
|  | google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= | ||||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
| gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| package goext | package goext | ||||||
|  |  | ||||||
| const GoextVersion = "0.0.566" | const GoextVersion = "0.0.593" | ||||||
|  |  | ||||||
| const GoextVersionTimestamp = "2025-02-28T21:46:26+0100" | const GoextVersionTimestamp = "2025-07-16T12:50:36+0200" | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| package googleapi | package googleapi | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"mime" | 	"mime" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| package googleapi | package googleapi | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"os" | 	"os" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -3,9 +3,9 @@ package googleapi | |||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/timeext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/timeext" | ||||||
| 	"io" | 	"io" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"sync" | 	"sync" | ||||||
|   | |||||||
| @@ -6,9 +6,9 @@ import ( | |||||||
| 	"encoding/base64" | 	"encoding/base64" | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext" | 	"git.blackforestbytes.com/BlackForestBytes/goext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"io" | 	"io" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -3,9 +3,9 @@ package googleapi | |||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"os" | 	"os" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
|  |  | ||||||
| package imageext | package imageext | ||||||
|  |  | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/langext" | import "git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/enums" | import "git.blackforestbytes.com/BlackForestBytes/goext/enums" | ||||||
|  |  | ||||||
| const ChecksumEnumGenerator = "1da5383c33ee442fd0b899369053f66bdc85bed2dbf906949d3edfeedfe13340" // GoExtVersion: 0.0.449 | const ChecksumEnumGenerator = "1da5383c33ee442fd0b899369053f66bdc85bed2dbf906949d3edfeedfe13340" // GoExtVersion: 0.0.449 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,8 +4,8 @@ import ( | |||||||
| 	"bytes" | 	"bytes" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/disintegration/imaging" | 	"github.com/disintegration/imaging" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/mathext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/mathext" | ||||||
| 	"image" | 	"image" | ||||||
| 	"image/color" | 	"image/color" | ||||||
| 	"image/draw" | 	"image/draw" | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| package langext | package langext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| package langext | package langext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										23
									
								
								langext/base64.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								langext/base64.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | package langext | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"encoding/base64" | ||||||
|  | 	"strings" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | // DecodeBase64Any decodes a base64 encoded string | ||||||
|  | // Works with all variants (std, url, imap), padded and unpadded and even ignores linrebreaks and indents | ||||||
|  | func DecodeBase64Any(data string) ([]byte, error) { | ||||||
|  | 	data = strings.ReplaceAll(data, "\n", "") // remove linebreaks and indents | ||||||
|  | 	data = strings.ReplaceAll(data, "\t", "") // remove linebreaks and indents | ||||||
|  | 	data = strings.ReplaceAll(data, " ", "")  // remove linebreaks and indents | ||||||
|  |  | ||||||
|  | 	data = strings.ReplaceAll(data, ",", "/") // base64_imap --> base64_std | ||||||
|  |  | ||||||
|  | 	data = strings.ReplaceAll(data, "_", "/") // base64_url --> base64_std | ||||||
|  | 	data = strings.ReplaceAll(data, "-", "+") // base64_url --> base64_std | ||||||
|  |  | ||||||
|  | 	data = strings.ReplaceAll(data, "=", "") // no padding | ||||||
|  |  | ||||||
|  | 	return base64.RawStdEncoding.DecodeString(data) | ||||||
|  | } | ||||||
							
								
								
									
										246
									
								
								langext/base64_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										246
									
								
								langext/base64_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,246 @@ | |||||||
|  | package langext | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"testing" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_StandardPadded(t *testing.T) { | ||||||
|  | 	input := "SGVsbG8gV29ybGQ=" // "Hello World" in standard Base64 (padded) | ||||||
|  | 	expected := "Hello World" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_StandardUnpadded(t *testing.T) { | ||||||
|  | 	input := "SGVsbG8gV29ybGQ" // "Hello World" in standard Base64 (unpadded) | ||||||
|  | 	expected := "Hello World" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_URLPadded(t *testing.T) { | ||||||
|  | 	input := "SGVsbG8tV29ybGQ=" // "Hello-World" in Base64 URL (padded) | ||||||
|  | 	expected := "Hello-World" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_URLUnpadded(t *testing.T) { | ||||||
|  | 	input := "SGVsbG8tV29ybGQ" // "Hello-World" in Base64 URL (unpadded) | ||||||
|  | 	expected := "Hello-World" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_IMAPPadded(t *testing.T) { | ||||||
|  | 	input := "SGVsbG8,V29ybGQ=" // "Hello/World" in Base64 IMAP (padded) | ||||||
|  | 	expected := "Hello?World" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_IMAPUnpadded(t *testing.T) { | ||||||
|  | 	input := "SGVsbG8,V29ybGQ" // "Hello/World" in Base64 IMAP (unpadded) | ||||||
|  | 	expected := "Hello?World" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_InvalidInput(t *testing.T) { | ||||||
|  | 	input := "Invalid@@Base64" // Invalid Base64 input | ||||||
|  |  | ||||||
|  | 	_, err := DecodeBase64Any(input) | ||||||
|  | 	if err == nil { | ||||||
|  | 		t.Fatal("expected an error, but got none") | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_EmptyInput(t *testing.T) { | ||||||
|  | 	input := "" // Empty input | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if len(result) != 0 { | ||||||
|  | 		t.Errorf("expected empty result, got %q", string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_WhitespaceInput(t *testing.T) { | ||||||
|  | 	input := "  SGVsbG8gV29ybGQ=  " // Input with leading and trailing spaces | ||||||
|  | 	expected := "Hello World" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_LineBreaksInput(t *testing.T) { | ||||||
|  | 	input := "SGVs\nbG8g\nV29y\nbGQ=" // Input with line breaks | ||||||
|  | 	expected := "Hello World" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_TabCharactersInput(t *testing.T) { | ||||||
|  | 	input := "SGVsbG8g\tV29ybGQ=" // Input with tab characters | ||||||
|  | 	expected := "Hello World" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_SpecialCharactersIgnored(t *testing.T) { | ||||||
|  | 	input := "SGVsbG8gV29ybGQ=!!" // Input with ignored special characters | ||||||
|  |  | ||||||
|  | 	_, err := DecodeBase64Any(input) | ||||||
|  | 	if err == nil { | ||||||
|  | 		t.Fatal("expected an error, but got none") | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_SingleCharacterInput(t *testing.T) { | ||||||
|  | 	input := "QQ==" // "A" in Base64 | ||||||
|  | 	expected := "A" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_LongInput(t *testing.T) { | ||||||
|  | 	input := "U29tZSB2ZXJ5IGxvbmcgc3RyaW5nIHdpdGggbXVsdGlwbGUgbGluZXMgYW5kIHNwYWNlcy4=" // Long Base64 string | ||||||
|  | 	expected := "Some very long string with multiple lines and spaces." | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_Standard63And64(t *testing.T) { | ||||||
|  | 	input := "Pz8/Pw==" // "???" in standard Base64 (63 = '+', 64 = '/') | ||||||
|  | 	expected := "????" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_Standard63And64_NoPad(t *testing.T) { | ||||||
|  | 	input := "Pz8/Pw" // "???" in standard Base64 (63 = '+', 64 = '/') | ||||||
|  | 	expected := "????" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_URL63And64(t *testing.T) { | ||||||
|  | 	input := "Pz8_Pw==" // "???" in Base64 URL-safe (63 = '_', 64 = '-') | ||||||
|  | 	expected := "????" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDecodeBase64Any_URL63And64_NoPad(t *testing.T) { | ||||||
|  | 	input := "Pz8_Pw==" // "???" in Base64 URL-safe (63 = '_', 64 = '-') | ||||||
|  | 	expected := "????" | ||||||
|  |  | ||||||
|  | 	result, err := DecodeBase64Any(input) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("unexpected error: %v", err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if string(result) != expected { | ||||||
|  | 		t.Errorf("expected %q, got %q", expected, string(result)) | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| package langext | package langext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,7 +6,9 @@ import ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func BuildUrl(url, path string, params *map[string]string) string { | func BuildUrl(url, path string, params *map[string]string) string { | ||||||
| 	if path[:1] == "/" && url[len(url)-1:] == "/" { | 	if len(url) == 0 || len(path) == 0 { | ||||||
|  | 		url += path | ||||||
|  | 	} else if path[:1] == "/" && url[len(url)-1:] == "/" { | ||||||
| 		url += path[1:] | 		url += path[1:] | ||||||
| 	} else if path[:1] != "/" && url[len(url)-1:] != "/" { | 	} else if path[:1] != "/" && url[len(url)-1:] != "/" { | ||||||
| 		url += "/" + path | 		url += "/" + path | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| package langext | package langext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| package mathext | package mathext | ||||||
|  |  | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/langext" | import "git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
|  |  | ||||||
| func ClampInt(v int, lo int, hi int) int { | func ClampInt(v int, lo int, hi int) int { | ||||||
| 	if v < lo { | 	if v < lo { | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| package mathext | package mathext | ||||||
|  |  | ||||||
| import "gogs.mikescher.com/BlackForestBytes/goext/langext" | import "git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
|  |  | ||||||
| func AvgFloat64(arr []float64) float64 { | func AvgFloat64(arr []float64) float64 { | ||||||
| 	return SumFloat64(arr) / float64(len(arr)) | 	return SumFloat64(arr) / float64(len(arr)) | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| package mathext | package mathext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func Sum[T langext.NumberConstraint](v []T) T { | func Sum[T langext.NumberConstraint](v []T) T { | ||||||
|   | |||||||
| @@ -1,57 +1,51 @@ | |||||||
| package mongoext | package mongoext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/rfctime" | ||||||
| 	"go.mongodb.org/mongo-driver/bson" | 	"go.mongodb.org/mongo-driver/bson" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsontype" |  | ||||||
| 	"go.mongodb.org/mongo-driver/bson/primitive" | 	"go.mongodb.org/mongo-driver/bson/primitive" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" |  | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/rfctime" |  | ||||||
| 	"reflect" | 	"reflect" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func CreateGoExtBsonRegistry() *bsoncodec.Registry { | func CreateGoExtBsonRegistry() *bsoncodec.Registry { | ||||||
| 	rb := bsoncodec.NewRegistryBuilder() | 	reg := bson.NewRegistry() | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.RFC3339Time{}), rfctime.RFC3339Time{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(rfctime.RFC3339Time{}), rfctime.RFC3339Time{}) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(&rfctime.RFC3339Time{}), rfctime.RFC3339Time{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(&rfctime.RFC3339Time{}), rfctime.RFC3339Time{}) | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.RFC3339NanoTime{}), rfctime.RFC3339NanoTime{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(rfctime.RFC3339NanoTime{}), rfctime.RFC3339NanoTime{}) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(&rfctime.RFC3339NanoTime{}), rfctime.RFC3339NanoTime{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(&rfctime.RFC3339NanoTime{}), rfctime.RFC3339NanoTime{}) | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.UnixTime{}), rfctime.UnixTime{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(rfctime.UnixTime{}), rfctime.UnixTime{}) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(&rfctime.UnixTime{}), rfctime.UnixTime{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(&rfctime.UnixTime{}), rfctime.UnixTime{}) | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.UnixMilliTime{}), rfctime.UnixMilliTime{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(rfctime.UnixMilliTime{}), rfctime.UnixMilliTime{}) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(&rfctime.UnixMilliTime{}), rfctime.UnixMilliTime{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(&rfctime.UnixMilliTime{}), rfctime.UnixMilliTime{}) | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.UnixNanoTime{}), rfctime.UnixNanoTime{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(rfctime.UnixNanoTime{}), rfctime.UnixNanoTime{}) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(&rfctime.UnixNanoTime{}), rfctime.UnixNanoTime{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(&rfctime.UnixNanoTime{}), rfctime.UnixNanoTime{}) | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.Date{}), rfctime.Date{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(rfctime.Date{}), rfctime.Date{}) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(&rfctime.Date{}), rfctime.Date{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(&rfctime.Date{}), rfctime.Date{}) | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(rfctime.SecondsF64(0)), rfctime.SecondsF64(0)) | 	reg.RegisterTypeDecoder(reflect.TypeOf(rfctime.SecondsF64(0)), rfctime.SecondsF64(0)) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(langext.Ptr(rfctime.SecondsF64(0))), rfctime.SecondsF64(0)) | 	reg.RegisterTypeDecoder(reflect.TypeOf(langext.Ptr(rfctime.SecondsF64(0))), rfctime.SecondsF64(0)) | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(exerr.ErrorCategory{}), exerr.ErrorCategory{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(exerr.ErrorCategory{}), exerr.ErrorCategory{}) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(langext.Ptr(exerr.ErrorCategory{})), exerr.ErrorCategory{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(langext.Ptr(exerr.ErrorCategory{})), exerr.ErrorCategory{}) | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(exerr.ErrorSeverity{}), exerr.ErrorSeverity{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(exerr.ErrorSeverity{}), exerr.ErrorSeverity{}) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(langext.Ptr(exerr.ErrorSeverity{})), exerr.ErrorSeverity{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(langext.Ptr(exerr.ErrorSeverity{})), exerr.ErrorSeverity{}) | ||||||
|  |  | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(exerr.ErrorType{}), exerr.ErrorType{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(exerr.ErrorType{}), exerr.ErrorType{}) | ||||||
| 	rb.RegisterTypeDecoder(reflect.TypeOf(langext.Ptr(exerr.ErrorType{})), exerr.ErrorType{}) | 	reg.RegisterTypeDecoder(reflect.TypeOf(langext.Ptr(exerr.ErrorType{})), exerr.ErrorType{}) | ||||||
|  |  | ||||||
| 	bsoncodec.DefaultValueEncoders{}.RegisterDefaultEncoders(rb) |  | ||||||
| 	bsoncodec.DefaultValueDecoders{}.RegisterDefaultDecoders(rb) |  | ||||||
|  |  | ||||||
| 	bson.PrimitiveCodecs{}.RegisterPrimitiveCodecs(rb) |  | ||||||
|  |  | ||||||
| 	// otherwise we get []primitve.E when unmarshalling into any | 	// otherwise we get []primitve.E when unmarshalling into any | ||||||
| 	// which will result in {'key': .., 'value': ...}[] json when json-marshalling | 	// which will result in {'key': .., 'value': ...}[] json when json-marshalling | ||||||
| 	rb.RegisterTypeMapEntry(bsontype.EmbeddedDocument, reflect.TypeOf(primitive.M{})) | 	reg.RegisterTypeMapEntry(bson.TypeEmbeddedDocument, reflect.TypeOf(primitive.M{})) | ||||||
|  |  | ||||||
| 	return rb.Build() | 	return reg | ||||||
| } | } | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package reflectext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"strings" | 	"strings" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package reflectext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package reflectext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/primitive" | 	"go.mongodb.org/mongo-driver/bson/primitive" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ package reflectext | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package reflectext | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| package rext | package rext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"regexp" | 	"regexp" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| package rext | package rext | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"regexp" | 	"regexp" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -10,7 +10,8 @@ type RFCTime interface { | |||||||
|  |  | ||||||
| 	After(u AnyTime) bool | 	After(u AnyTime) bool | ||||||
| 	Before(u AnyTime) bool | 	Before(u AnyTime) bool | ||||||
| 	Equal(u AnyTime) bool |  | ||||||
|  | 	EqualAny(u AnyTime) bool | ||||||
|  |  | ||||||
| 	Sub(u AnyTime) time.Duration | 	Sub(u AnyTime) time.Duration | ||||||
| } | } | ||||||
| @@ -49,45 +50,15 @@ type AnyTime interface { | |||||||
| } | } | ||||||
|  |  | ||||||
| type RFCDuration interface { | type RFCDuration interface { | ||||||
| 	Time() time.Time | 	Hours() float64 | ||||||
| 	Serialize() string | 	Minutes() float64 | ||||||
|  | 	Seconds() float64 | ||||||
| 	UnmarshalJSON(bytes []byte) error | 	Microseconds() int64 | ||||||
| 	MarshalJSON() ([]byte, error) | 	Milliseconds() int64 | ||||||
|  | 	Nanoseconds() int64 | ||||||
| 	MarshalBinary() ([]byte, error) |  | ||||||
| 	UnmarshalBinary(data []byte) error |  | ||||||
|  |  | ||||||
| 	GobEncode() ([]byte, error) |  | ||||||
| 	GobDecode(data []byte) error |  | ||||||
|  |  | ||||||
| 	MarshalText() ([]byte, error) |  | ||||||
| 	UnmarshalText(data []byte) error |  | ||||||
|  |  | ||||||
| 	After(u AnyTime) bool |  | ||||||
| 	Before(u AnyTime) bool |  | ||||||
| 	Equal(u AnyTime) bool |  | ||||||
| 	IsZero() bool |  | ||||||
| 	Date() (year int, month time.Month, day int) |  | ||||||
| 	Year() int |  | ||||||
| 	Month() time.Month |  | ||||||
| 	Day() int |  | ||||||
| 	Weekday() time.Weekday |  | ||||||
| 	ISOWeek() (year, week int) |  | ||||||
| 	Clock() (hour, min, sec int) |  | ||||||
| 	Hour() int |  | ||||||
| 	Minute() int |  | ||||||
| 	Second() int |  | ||||||
| 	Nanosecond() int |  | ||||||
| 	YearDay() int |  | ||||||
| 	Sub(u AnyTime) time.Duration |  | ||||||
| 	Unix() int64 |  | ||||||
| 	UnixMilli() int64 |  | ||||||
| 	UnixMicro() int64 |  | ||||||
| 	UnixNano() int64 |  | ||||||
| 	Format(layout string) string |  | ||||||
| 	GoString() string |  | ||||||
| 	String() string | 	String() string | ||||||
|  |  | ||||||
|  | 	Duration() time.Duration | ||||||
| } | } | ||||||
|  |  | ||||||
| func tt(v AnyTime) time.Time { | func tt(v AnyTime) time.Time { | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| package rfctime | package rfctime | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -4,11 +4,11 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"go.mongodb.org/mongo-driver/bson" | 	"go.mongodb.org/mongo-driver/bson" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsonrw" | 	"go.mongodb.org/mongo-driver/bson/bsonrw" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsontype" | 	"go.mongodb.org/mongo-driver/bson/bsontype" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
| @@ -142,7 +142,14 @@ func (t RFC3339Time) Before(u AnyTime) bool { | |||||||
| 	return t.Time().Before(tt(u)) | 	return t.Time().Before(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (t RFC3339Time) Equal(u AnyTime) bool { | func (t RFC3339Time) Equal(u RFC3339Time) bool { | ||||||
|  | 	return t.Time().Equal(u.Time()) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (t RFC3339Time) EqualAny(u AnyTime) bool { | ||||||
|  | 	if u == nil { | ||||||
|  | 		return false | ||||||
|  | 	} | ||||||
| 	return t.Time().Equal(tt(u)) | 	return t.Time().Equal(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,11 +4,11 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"go.mongodb.org/mongo-driver/bson" | 	"go.mongodb.org/mongo-driver/bson" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsonrw" | 	"go.mongodb.org/mongo-driver/bson/bsonrw" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsontype" | 	"go.mongodb.org/mongo-driver/bson/bsontype" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
| @@ -142,7 +142,14 @@ func (t RFC3339NanoTime) Before(u AnyTime) bool { | |||||||
| 	return t.Time().Before(tt(u)) | 	return t.Time().Before(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (t RFC3339NanoTime) Equal(u AnyTime) bool { | func (t RFC3339NanoTime) Equal(u RFC3339NanoTime) bool { | ||||||
|  | 	return t.Time().Equal(u.Time()) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (t RFC3339NanoTime) EqualAny(u AnyTime) bool { | ||||||
|  | 	if u == nil { | ||||||
|  | 		return false | ||||||
|  | 	} | ||||||
| 	return t.Time().Equal(tt(u)) | 	return t.Time().Equal(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ package rfctime | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/timeext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/timeext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
| @@ -41,7 +41,7 @@ func TestRoundtrip(t *testing.T) { | |||||||
|  |  | ||||||
| 	tst.AssertEqual(t, string(jstr1), string(jstr2)) | 	tst.AssertEqual(t, string(jstr1), string(jstr2)) | ||||||
|  |  | ||||||
| 	if !w1.Value.Equal(&w2.Value) { | 	if !w1.Value.EqualAny(&w2.Value) { | ||||||
| 		t.Errorf("time differs") | 		t.Errorf("time differs") | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,11 +4,11 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/timeext" | ||||||
| 	"go.mongodb.org/mongo-driver/bson" | 	"go.mongodb.org/mongo-driver/bson" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsonrw" | 	"go.mongodb.org/mongo-driver/bson/bsonrw" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsontype" | 	"go.mongodb.org/mongo-driver/bson/bsontype" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/timeext" |  | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ package rfctime | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
|   | |||||||
| @@ -4,11 +4,11 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"go.mongodb.org/mongo-driver/bson" | 	"go.mongodb.org/mongo-driver/bson" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsonrw" | 	"go.mongodb.org/mongo-driver/bson/bsonrw" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsontype" | 	"go.mongodb.org/mongo-driver/bson/bsontype" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| @@ -136,7 +136,14 @@ func (t UnixTime) Before(u AnyTime) bool { | |||||||
| 	return t.Time().Before(tt(u)) | 	return t.Time().Before(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (t UnixTime) Equal(u AnyTime) bool { | func (t UnixTime) Equal(u UnixTime) bool { | ||||||
|  | 	return t.Time().Equal(u.Time()) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (t UnixTime) EqualAny(u AnyTime) bool { | ||||||
|  | 	if u == nil { | ||||||
|  | 		return false | ||||||
|  | 	} | ||||||
| 	return t.Time().Equal(tt(u)) | 	return t.Time().Equal(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,11 +4,11 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"go.mongodb.org/mongo-driver/bson" | 	"go.mongodb.org/mongo-driver/bson" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsonrw" | 	"go.mongodb.org/mongo-driver/bson/bsonrw" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsontype" | 	"go.mongodb.org/mongo-driver/bson/bsontype" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| @@ -136,7 +136,14 @@ func (t UnixMilliTime) Before(u AnyTime) bool { | |||||||
| 	return t.Time().Before(tt(u)) | 	return t.Time().Before(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (t UnixMilliTime) Equal(u AnyTime) bool { | func (t UnixMilliTime) Equal(u UnixMilliTime) bool { | ||||||
|  | 	return t.Time().Equal(u.Time()) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (t UnixMilliTime) EqualAny(u AnyTime) bool { | ||||||
|  | 	if u == nil { | ||||||
|  | 		return false | ||||||
|  | 	} | ||||||
| 	return t.Time().Equal(tt(u)) | 	return t.Time().Equal(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,11 +4,11 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"go.mongodb.org/mongo-driver/bson" | 	"go.mongodb.org/mongo-driver/bson" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | 	"go.mongodb.org/mongo-driver/bson/bsoncodec" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsonrw" | 	"go.mongodb.org/mongo-driver/bson/bsonrw" | ||||||
| 	"go.mongodb.org/mongo-driver/bson/bsontype" | 	"go.mongodb.org/mongo-driver/bson/bsontype" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" |  | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| @@ -136,7 +136,14 @@ func (t UnixNanoTime) Before(u AnyTime) bool { | |||||||
| 	return t.Time().Before(tt(u)) | 	return t.Time().Before(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (t UnixNanoTime) Equal(u AnyTime) bool { | func (t UnixNanoTime) Equal(u UnixNanoTime) bool { | ||||||
|  | 	return t.Time().Equal(u.Time()) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (t UnixNanoTime) EqualAny(u AnyTime) bool { | ||||||
|  | 	if u == nil { | ||||||
|  | 		return false | ||||||
|  | 	} | ||||||
| 	return t.Time().Equal(tt(u)) | 	return t.Time().Equal(tt(u)) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,9 +3,9 @@ package scn | |||||||
| import ( | import ( | ||||||
| 	"bytes" | 	"bytes" | ||||||
| 	"context" | 	"context" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	json "gogs.mikescher.com/BlackForestBytes/goext/gojson" | 	json "git.blackforestbytes.com/BlackForestBytes/goext/gojson" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"io" | 	"io" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"time" | 	"time" | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ package sq | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"strings" | 	"strings" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -7,8 +7,8 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/glebarez/go-sqlite" | 	"github.com/glebarez/go-sqlite" | ||||||
| 	"github.com/jmoiron/sqlx" | 	"github.com/jmoiron/sqlx" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/tst" | 	"git.blackforestbytes.com/BlackForestBytes/goext/tst" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ package sq | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,10 +3,10 @@ package sq | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/exerr" | 	"git.blackforestbytes.com/BlackForestBytes/goext/exerr" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/langext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/langext" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/rfctime" | 	"git.blackforestbytes.com/BlackForestBytes/goext/rfctime" | ||||||
| 	"gogs.mikescher.com/BlackForestBytes/goext/timeext" | 	"git.blackforestbytes.com/BlackForestBytes/goext/timeext" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user