Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
dad0e3240d
|
@@ -20,7 +20,6 @@ require (
|
|||||||
github.com/gorilla/websocket v1.5.3
|
github.com/gorilla/websocket v1.5.3
|
||||||
github.com/jung-kurt/gofpdf v1.16.2
|
github.com/jung-kurt/gofpdf v1.16.2
|
||||||
github.com/xuri/excelize/v2 v2.10.1
|
github.com/xuri/excelize/v2 v2.10.1
|
||||||
go.mongodb.org/mongo-driver v1.17.9
|
|
||||||
golang.org/x/sync v0.20.0
|
golang.org/x/sync v0.20.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -136,8 +136,6 @@ github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9/go.mod h1:WwHg+CVyzlv/T
|
|||||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
|
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
|
||||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
go.mongodb.org/mongo-driver v1.17.9 h1:IexDdCuuNJ3BHrELgBlyaH9p60JXAvdzWR128q+U5tU=
|
|
||||||
go.mongodb.org/mongo-driver v1.17.9/go.mod h1:LlOhpH5NUEfhxcAwG0UEkMqwYcc4JU18gtCdGudk/tQ=
|
|
||||||
go.mongodb.org/mongo-driver/v2 v2.5.1 h1:j2U/Qp+wvueSpqitLCSZPT/+ZpVc1xzuwdHWwl7d8ro=
|
go.mongodb.org/mongo-driver/v2 v2.5.1 h1:j2U/Qp+wvueSpqitLCSZPT/+ZpVc1xzuwdHWwl7d8ro=
|
||||||
go.mongodb.org/mongo-driver/v2 v2.5.1/go.mod h1:yOI9kBsufol30iFsl1slpdq1I0eHPzybRWdyYUs8K/0=
|
go.mongodb.org/mongo-driver/v2 v2.5.1/go.mod h1:yOI9kBsufol30iFsl1slpdq1I0eHPzybRWdyYUs8K/0=
|
||||||
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
|
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.635"
|
const GoextVersion = "0.0.636"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2026-04-26T14:47:05+0200"
|
const GoextVersionTimestamp = "2026-04-26T14:53:24+0200"
|
||||||
|
|||||||
+10
-44
@@ -4,13 +4,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/bsoncodec"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/bsonrw"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/bsontype"
|
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/v2/bson"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UnixTime time.Time
|
type UnixTime time.Time
|
||||||
@@ -66,8 +63,8 @@ func (t *UnixTime) UnmarshalText(data []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *UnixTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
func (t *UnixTime) UnmarshalBSONValue(bt byte, data []byte) error {
|
||||||
if bt == bson.TypeNull {
|
if bson.Type(bt) == bson.TypeNull {
|
||||||
// we can't set nil in UnmarshalBSONValue (so we use default(struct))
|
// we can't set nil in UnmarshalBSONValue (so we use default(struct))
|
||||||
// Use mongoext.CreateGoExtBsonRegistry if you need to unmarsh pointer values
|
// Use mongoext.CreateGoExtBsonRegistry if you need to unmarsh pointer values
|
||||||
// https://stackoverflow.com/questions/75167597
|
// https://stackoverflow.com/questions/75167597
|
||||||
@@ -75,11 +72,11 @@ func (t *UnixTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
|||||||
*t = UnixTime{}
|
*t = UnixTime{}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if bt != bson.TypeDateTime {
|
if bson.Type(bt) != bson.TypeDateTime {
|
||||||
return errors.New(fmt.Sprintf("cannot unmarshal %v into UnixTime", bt))
|
return errors.New(fmt.Sprintf("cannot unmarshal %v into UnixTime", bson.Type(bt)))
|
||||||
}
|
}
|
||||||
var tt time.Time
|
var tt time.Time
|
||||||
err := bson.RawValue{Type: bt, Value: data}.Unmarshal(&tt)
|
err := bson.RawValue{Type: bson.Type(bt), Value: data}.Unmarshal(&tt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -87,40 +84,9 @@ func (t *UnixTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t UnixTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
|
func (t UnixTime) MarshalBSONValue() (byte, []byte, error) {
|
||||||
return bson.MarshalValue(time.Time(t))
|
tp, data, err := bson.MarshalValue(time.Time(t))
|
||||||
}
|
return byte(tp), data, err
|
||||||
|
|
||||||
func (t UnixTime) DecodeValue(dc bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error {
|
|
||||||
if val.Kind() == reflect.Pointer && val.IsNil() {
|
|
||||||
if !val.CanSet() {
|
|
||||||
return errors.New("ValueUnmarshalerDecodeValue")
|
|
||||||
}
|
|
||||||
val.Set(reflect.New(val.Type().Elem()))
|
|
||||||
}
|
|
||||||
|
|
||||||
tp, src, err := bsonrw.Copier{}.CopyValueToBytes(vr)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if val.Kind() == reflect.Pointer && len(src) == 0 {
|
|
||||||
val.Set(reflect.Zero(val.Type()))
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
err = t.UnmarshalBSONValue(tp, src)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if val.Kind() == reflect.Pointer {
|
|
||||||
val.Set(reflect.ValueOf(&t))
|
|
||||||
} else {
|
|
||||||
val.Set(reflect.ValueOf(t))
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t UnixTime) Serialize() string {
|
func (t UnixTime) Serialize() string {
|
||||||
|
|||||||
+10
-44
@@ -4,13 +4,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/bsoncodec"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/bsonrw"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/bsontype"
|
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/v2/bson"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UnixMilliTime time.Time
|
type UnixMilliTime time.Time
|
||||||
@@ -66,8 +63,8 @@ func (t *UnixMilliTime) UnmarshalText(data []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *UnixMilliTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
func (t *UnixMilliTime) UnmarshalBSONValue(bt byte, data []byte) error {
|
||||||
if bt == bson.TypeNull {
|
if bson.Type(bt) == bson.TypeNull {
|
||||||
// we can't set nil in UnmarshalBSONValue (so we use default(struct))
|
// we can't set nil in UnmarshalBSONValue (so we use default(struct))
|
||||||
// Use mongoext.CreateGoExtBsonRegistry if you need to unmarsh pointer values
|
// Use mongoext.CreateGoExtBsonRegistry if you need to unmarsh pointer values
|
||||||
// https://stackoverflow.com/questions/75167597
|
// https://stackoverflow.com/questions/75167597
|
||||||
@@ -75,11 +72,11 @@ func (t *UnixMilliTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error
|
|||||||
*t = UnixMilliTime{}
|
*t = UnixMilliTime{}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if bt != bson.TypeDateTime {
|
if bson.Type(bt) != bson.TypeDateTime {
|
||||||
return errors.New(fmt.Sprintf("cannot unmarshal %v into UnixMilliTime", bt))
|
return errors.New(fmt.Sprintf("cannot unmarshal %v into UnixMilliTime", bson.Type(bt)))
|
||||||
}
|
}
|
||||||
var tt time.Time
|
var tt time.Time
|
||||||
err := bson.RawValue{Type: bt, Value: data}.Unmarshal(&tt)
|
err := bson.RawValue{Type: bson.Type(bt), Value: data}.Unmarshal(&tt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -87,40 +84,9 @@ func (t *UnixMilliTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t UnixMilliTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
|
func (t UnixMilliTime) MarshalBSONValue() (byte, []byte, error) {
|
||||||
return bson.MarshalValue(time.Time(t))
|
tp, data, err := bson.MarshalValue(time.Time(t))
|
||||||
}
|
return byte(tp), data, err
|
||||||
|
|
||||||
func (t UnixMilliTime) DecodeValue(dc bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error {
|
|
||||||
if val.Kind() == reflect.Pointer && val.IsNil() {
|
|
||||||
if !val.CanSet() {
|
|
||||||
return errors.New("ValueUnmarshalerDecodeValue")
|
|
||||||
}
|
|
||||||
val.Set(reflect.New(val.Type().Elem()))
|
|
||||||
}
|
|
||||||
|
|
||||||
tp, src, err := bsonrw.Copier{}.CopyValueToBytes(vr)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if val.Kind() == reflect.Pointer && len(src) == 0 {
|
|
||||||
val.Set(reflect.Zero(val.Type()))
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
err = t.UnmarshalBSONValue(tp, src)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if val.Kind() == reflect.Pointer {
|
|
||||||
val.Set(reflect.ValueOf(&t))
|
|
||||||
} else {
|
|
||||||
val.Set(reflect.ValueOf(t))
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t UnixMilliTime) Serialize() string {
|
func (t UnixMilliTime) Serialize() string {
|
||||||
|
|||||||
+10
-44
@@ -4,13 +4,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/bsoncodec"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/bsonrw"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/bsontype"
|
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/v2/bson"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UnixNanoTime time.Time
|
type UnixNanoTime time.Time
|
||||||
@@ -66,8 +63,8 @@ func (t *UnixNanoTime) UnmarshalText(data []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *UnixNanoTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
func (t *UnixNanoTime) UnmarshalBSONValue(bt byte, data []byte) error {
|
||||||
if bt == bson.TypeNull {
|
if bson.Type(bt) == bson.TypeNull {
|
||||||
// we can't set nil in UnmarshalBSONValue (so we use default(struct))
|
// we can't set nil in UnmarshalBSONValue (so we use default(struct))
|
||||||
// Use mongoext.CreateGoExtBsonRegistry if you need to unmarsh pointer values
|
// Use mongoext.CreateGoExtBsonRegistry if you need to unmarsh pointer values
|
||||||
// https://stackoverflow.com/questions/75167597
|
// https://stackoverflow.com/questions/75167597
|
||||||
@@ -75,11 +72,11 @@ func (t *UnixNanoTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
|||||||
*t = UnixNanoTime{}
|
*t = UnixNanoTime{}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if bt != bson.TypeDateTime {
|
if bson.Type(bt) != bson.TypeDateTime {
|
||||||
return errors.New(fmt.Sprintf("cannot unmarshal %v into UnixNanoTime", bt))
|
return errors.New(fmt.Sprintf("cannot unmarshal %v into UnixNanoTime", bson.Type(bt)))
|
||||||
}
|
}
|
||||||
var tt time.Time
|
var tt time.Time
|
||||||
err := bson.RawValue{Type: bt, Value: data}.Unmarshal(&tt)
|
err := bson.RawValue{Type: bson.Type(bt), Value: data}.Unmarshal(&tt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -87,40 +84,9 @@ func (t *UnixNanoTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t UnixNanoTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
|
func (t UnixNanoTime) MarshalBSONValue() (byte, []byte, error) {
|
||||||
return bson.MarshalValue(time.Time(t))
|
tp, data, err := bson.MarshalValue(time.Time(t))
|
||||||
}
|
return byte(tp), data, err
|
||||||
|
|
||||||
func (t UnixNanoTime) DecodeValue(dc bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error {
|
|
||||||
if val.Kind() == reflect.Pointer && val.IsNil() {
|
|
||||||
if !val.CanSet() {
|
|
||||||
return errors.New("ValueUnmarshalerDecodeValue")
|
|
||||||
}
|
|
||||||
val.Set(reflect.New(val.Type().Elem()))
|
|
||||||
}
|
|
||||||
|
|
||||||
tp, src, err := bsonrw.Copier{}.CopyValueToBytes(vr)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if val.Kind() == reflect.Pointer && len(src) == 0 {
|
|
||||||
val.Set(reflect.Zero(val.Type()))
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
err = t.UnmarshalBSONValue(tp, src)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if val.Kind() == reflect.Pointer {
|
|
||||||
val.Set(reflect.ValueOf(&t))
|
|
||||||
} else {
|
|
||||||
val.Set(reflect.ValueOf(t))
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t UnixNanoTime) Serialize() string {
|
func (t UnixNanoTime) Serialize() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user