mongoutil

package
v0.0.0-...-e906cca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormTimeOfTimeZone

func FormTimeOfTimeZone(pt time.Time, zone string) time.Time

func FormatPrimitiveTimeOfTimeZone

func FormatPrimitiveTimeOfTimeZone(pt primitive.DateTime, zone string) time.Time

func ObjectIDFromHex

func ObjectIDFromHex(id string) primitive.ObjectID

func StructToBSONM

func StructToBSONM(v interface{}, ignoreZeroValue bool, tagName string) bson.M

StructToBSONM 将结构体转换为 bson.M 参数:

  • v: 要转换的结构体
  • ignoreZeroValue: 是否忽略零值字段
  • tagName: 要使用的标签名称,通常是 "bson"

func StructToUpdateBSON

func StructToUpdateBSON(v interface{}, ignoreZeroValue bool) bson.D

辅助函数:将结构体转化为用于更新的 bson.D(带有 $set 操作符)

Types

type DocumentPartitionHelper

type DocumentPartitionHelper struct {
	// contains filtered or unexported fields
}

func NewDefPartitionHelper

func NewDefPartitionHelper(tableName string, sizes ...int) *DocumentPartitionHelper

func NewDocumentPartitionHelper

func NewDocumentPartitionHelper(replicas, ringSize int, tableBaseName string) *DocumentPartitionHelper

func (*DocumentPartitionHelper) GetCollName

func (r *DocumentPartitionHelper) GetCollName(key string) string

GetMessageName 获取Key对应的节点

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL