ul

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrDestinationIsNotInitialised = "destination is not initialised"
	ErrFUnsupportedDataType        = "unsupported data type: %s"
	ErrFDuplicateUid               = "duplicate uid: %v"
	ErrFUidIsNotFound              = "uid is not found: %v"
	ErrEdgePosition                = "edge position"
)
View Source
const (
	ListItemSeparator = ","
	StringOnError     = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type UidList

type UidList []uint

UidList is a list unique identifiers.

The main purpose of this list is to store a chronological order of all added items. An identifier is an unsigned integer number. The order of items in the list is important. New items are added to the end of the list, deleted items shift existing items.

func New

func New() (ul *UidList)

func NewFromArray

func NewFromArray(uids []uint) (ul *UidList, err error)

func (*UidList) AddItem

func (ul *UidList) AddItem(uid uint, addToTop bool) (err error)

AddItem add a new identifier to the end of the list. If 'addToTop' is set to 'True', then the item is added to the beginning (top) of the list; otherwise – to the end (bottom) of the list.

func (*UidList) CheckIntegrity

func (ul *UidList) CheckIntegrity() (err error)

CheckIntegrity verifies integrity of the list. All items must be unique to pass the check.

func (*UidList) MoveItemDown added in v0.0.38

func (ul *UidList) MoveItemDown(uid uint) (err error)

MoveItemDown moves an existing identifier one position downwards if possible.

func (*UidList) MoveItemUp added in v0.0.38

func (ul *UidList) MoveItemUp(uid uint) (err error)

MoveItemUp moves an existing identifier one position upwards if possible.

func (*UidList) OnPage

func (ul *UidList) OnPage(pageNumber uint, pageSize uint) (ulop *UidList)

func (*UidList) RaiseItem

func (ul *UidList) RaiseItem(uid uint) (isAlreadyRaised bool, err error)

RaiseItem moves an existing identifier to the top of the list.

func (*UidList) RemoveItem

func (ul *UidList) RemoveItem(uid uint) (err error)

RemoveItem deletes an identifier from the list shifting its items.

func (*UidList) Scan

func (ul *UidList) Scan(src any) (err error)

Scan method provides compatibility with SQL JSON data type.

func (*UidList) Size

func (ul *UidList) Size() (n int)

func (*UidList) Value

func (ul *UidList) Value() (dv driver.Value, err error)

Value method provides compatibility with SQL JSON data type.

func (*UidList) ValuesString

func (ul *UidList) ValuesString() (values string, err error)

Jump to

Keyboard shortcuts

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