pckstr

package module
v0.0.0-...-60660d0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 6 Imported by: 0

README

go-pckstr

Package pckstr provides packed-strings, for the Go programming-language (golang). A packed-strings is an alternative to []string that can be compared using == and != operators.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-pckstr

GoDoc

Example

Here is an example of creating a packed-strings:

import "github.com/reiver/go-pckstr"

// ...

packed := pckstr.SomeStrings("Once", "Twice", "Thrice", "Fource")

Here is an example of unpacking a packed-strings:

import "github.com/reiver/go-pckstr"

// ...

strings := packed.Strings()
// strings == []string{"Once", "Twice", "Thrice", "Fource"}

Here is an example of using == to compare a packed-strings:

import "github.com/reiver/go-pckstr"

// ...

packed := pckstr.SomeStrings("apple", "BANANA", "Cherry", "dAtE")

// ...

if pckstr.NoString() == packed {
	// ...
}

Import

To import package pckstr use import code like the follownig:

import "github.com/reiver/go-pckstr"

Installation

To install package pckstr do the following:

GOPROXY=direct go get github.com/reiver/go-pckstr

Author

Package pckstr was written by Charles Iliya Krempeaux

Documentation

Index

Constants

View Source
const (
	ErrNilReceiver = erorr.Error("nil receiver")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PackedStrings

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

func NoStrings

func NoStrings() PackedStrings

func Nothing

func Nothing() PackedStrings

Nothing return a 'nothing' optional-type value.

PackedStrings is an optional-type.

Nothing should not be confused with NoStrings.

func SomeString

func SomeString(str string) PackedStrings

func SomeStrings

func SomeStrings(strs ...string) PackedStrings

func (PackedStrings) GoString

func (receiver PackedStrings) GoString() string

func (PackedStrings) IsNothing

func (receiver PackedStrings) IsNothing() bool

func (PackedStrings) LenZero

func (receiver PackedStrings) LenZero() bool

func (PackedStrings) MarshalJSON

func (receiver PackedStrings) MarshalJSON() ([]byte, error)

func (PackedStrings) Strings

func (receiver PackedStrings) Strings() []string

func (*PackedStrings) UnmarshalJSON

func (receiver *PackedStrings) UnmarshalJSON(bytes []byte) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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