id

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package id provides some nifty tools for manipulating mongodb objectIDs. They are not baked into rosetta (where they belong, conceptually) because it would introduce a dependency on the mongodb driver, which does not make sense for rosetta. So, they're here. Deal with it :)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(value any) (primitive.ObjectID, error)

func FromBytes

func FromBytes(value []byte) primitive.ObjectID

func ID

func ID(value any) primitive.ObjectID

Converts a value into an ObjectID. If the value cannot be converted, then a new ObjectID is returned

func SliceOfString

func SliceOfString(value []primitive.ObjectID) []string

func SliceSchema

func SliceSchema() schema.Element

func Sort

func Sort(value []primitive.ObjectID) []primitive.ObjectID

func ToBytes

func ToBytes(value primitive.ObjectID) []byte

Types

type Slice

type Slice []primitive.ObjectID

func NewSlice

func NewSlice() Slice

func SliceOfID

func SliceOfID(value any) Slice

Converts a value into a slice of ObjectIDs

func (Slice) GetStringOK

func (slice Slice) GetStringOK(name string) (string, bool)

func (Slice) Length

func (slice Slice) Length() int

func (*Slice) SetString

func (slice *Slice) SetString(name string, value string) bool

func (*Slice) SetValue

func (slice *Slice) SetValue(value any) error

Jump to

Keyboard shortcuts

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