ident

package
v0.0.0-...-9034458 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b Id) int

for some reason strings.Compare doesnt exist in go/appengine: theres this comment in the string source: NOTE(rsc): ... Basically no one should use strings.Compare.

func Dash

func Dash(id Id) string

Types

type Id

type Id string

Id uniquely identifies some resource. NOTE: go is not capable of comparing slices(!?), and there is no interface for making a type hashable(!?) ALSO: the default json encoding --- even when the marshal is implemented!? -- doesnt seem to support a struct as a map key. Therefore, Id cannot store its parts as an []string. they must be joined first.

func Empty

func Empty() (ret Id)

func Join

func Join(a, b Id) Id

func MakeId

func MakeId(name string) (ret Id)

MakeId creates a new string id from the passed raw string. Dashes and spaces are treated as word separators; sequences of numbers and sequences of letters are treated as separate words. NOTE: Articles ( the, etc. ) are stripped for easier matching at the script/table/level.

func (Id) Empty

func (id Id) Empty() bool

func (Id) Equals

func (id Id) Equals(other Id) bool

func (Id) Raw

func (id Id) Raw() string

func (Id) Reserved

func (id Id) Reserved() bool

Reserved using an indicator to tag unique strings ids. FIX: i think with a judicious use of name vs. id -- this could be removed. ie. allow ids to be non-dashed, raw text. the dashing was in part to normalize multiple spaces and capitializations.

func (Id) Split

func (id Id) Split() (ret []string)

Split the id into separated, lower cased components.

func (Id) String

func (id Id) String() (ret string)

String representation of the id (ex. for fmt), currently TitleCase.

type IdSlice

type IdSlice []Id

IdSlice interface for sort

func (IdSlice) Len

func (p IdSlice) Len() int

func (IdSlice) Less

func (p IdSlice) Less(i, j int) bool

func (IdSlice) Swap

func (p IdSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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