dsutils

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Image README

Utils

Currently just has key creation with namespace as a parameter.

Happy to add more.

Usage

// Using Must versions (panics on error)
key := dsutils.MustIncompleteKeyWithNamespace(model.OptionKind, "namespace", nil)
key := dsutils.MustNameKeyWithNamespace(model.OptionKind, "namespace", "Name", nil)
key := dsutils.MustIDKeyWithNamespace(model.OptionKind, "namespace", int64(Id), nil)

// Using error return versions
key, err := dsutils.IncompleteKeyWithNamespace(model.OptionKind, "namespace", nil)
if err != nil {
    // handle error
}

key, err = dsutils.NameKeyWithNamespace(model.OptionKind, "namespace", "Name", nil)
if err != nil {
    // handle error
}

key, err = dsutils.IDKeyWithNamespace(model.OptionKind, "namespace", int64(Id), nil)
if err != nil {
    // handle error
}

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Image Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDKeyWithNamespace

func IDKeyWithNamespace(kind, namespace string, id int64, parent *datastore.Key) (*datastore.Key, error)

IDKeyWithNamespace creates a new key with an ID. The supplied kind cannot be empty. The supplied parent must either be a complete key or nil. The namespace of the new key can be empty.

func IncompleteKeyWithNamespace

func IncompleteKeyWithNamespace(kind, namespace string, parent *datastore.Key) (*datastore.Key, error)

IncompleteKeyWithNamespace creates a new incomplete key. The supplied kind cannot be empty. The namespace of the new key can be empty.

func MustIDKeyWithNamespace

func MustIDKeyWithNamespace(kind, namespace string, id int64, parent *datastore.Key) *datastore.Key

MustIDKeyWithNamespace creates a new key with an ID and panics on error.

func MustIncompleteKeyWithNamespace

func MustIncompleteKeyWithNamespace(kind, namespace string, parent *datastore.Key) *datastore.Key

MustIncompleteKeyWithNamespace creates a new incomplete key and panics on error.

func MustNameKeyWithNamespace

func MustNameKeyWithNamespace(kind, namespace, name string, parent *datastore.Key) *datastore.Key

MustNameKeyWithNamespace creates a new key with a name and panics on error.

func NameKeyWithNamespace

func NameKeyWithNamespace(kind, namespace, name string, parent *datastore.Key) (*datastore.Key, error)

NameKeyWithNamespace creates a new key with a name. The supplied kind cannot be empty. The supplied parent must either be a complete key or nil. The namespace of the new key can be empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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