docid

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Examples

Constants

View Source
const (
	SymbolMinus byte = '-'
	SymbolSlash byte = '/'
	SymbolDot   byte = '.'
	SymbolColon byte = ':'
)

byte symbols

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes []byte

Bytes is byte slice

type BytesSlice

type BytesSlice []Bytes

BytesSlice is slice of Bytes

type DocID

type DocID [docIDLength]byte

DocID is 32 bytes array

func FromBytes

func FromBytes(data Bytes) (docid *DocID, err error)

FromBytes parse DocID from bytes

func FromDocIDHexBytes

func FromDocIDHexBytes(data Bytes) (docid *DocID, err error)

FromDocIDHexBytes parse DocID from hex bytes

func FromDocIDHexReadableBytes

func FromDocIDHexReadableBytes(data Bytes) (docid *DocID, err error)

FromDocIDHexReadableBytes parse DocID from readable hex bytes

func FromURLBytes

func FromURLBytes(urlBytes Bytes) (docid *DocID, err error)

FromURLBytes parse DocID from URL bytes

func New

func New(data interface{}) (docid *DocID, err error)

New create new DocID

Example
docid, _ := New("http://www.google.com/")
fmt.Println(docid)
docid, _ = New("1d5920f4b44b27a8-ed646a3334ca891f-ff90821feeb2b02a33a6f9fc8e5f3fcd")
fmt.Println(docid)
docid, _ = New("1d5920f4b44b27a8-ed646a3334ca891f-ff90821feeb2b02a33a6f9fc8e5f3fcd")
fmt.Println(docid)
Output:

1d5920f4b44b27a8-ed646a3334ca891f-ff90821feeb2b02a33a6f9fc8e5f3fcd
1d5920f4b44b27a8-ed646a3334ca891f-ff90821feeb2b02a33a6f9fc8e5f3fcd
1d5920f4b44b27a8-ed646a3334ca891f-ff90821feeb2b02a33a6f9fc8e5f3fcd

func (*DocID) DomainID

func (docid *DocID) DomainID() *DomainID

DomainID get the domain ID

func (*DocID) SiteID

func (docid *DocID) SiteID() *SiteID

SiteID get the Site ID

func (*DocID) String

func (docid *DocID) String() string

func (*DocID) URLID

func (docid *DocID) URLID() *URLID

URLID get the URL ID

type DomainID

type DomainID [domainIDLength]byte

DomainID is the first 8 bytes of DocID

func (*DomainID) String

func (id *DomainID) String() string

type InvalidBytesError

type InvalidBytesError Bytes

InvalidBytesError value describe invalid bytes

func (InvalidBytesError) Error

func (e InvalidBytesError) Error() string

type SiteID

type SiteID [siteIDLength]byte

SiteID is the middle 8 bytes of DocID

func (*SiteID) String

func (id *SiteID) String() string

type URLID

type URLID [urlIDLength]byte

URLID is the last 16 bytes of DocID

func (*URLID) String

func (id *URLID) String() string

Jump to

Keyboard shortcuts

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