stringutil

package
v0.0.0-...-cdf87ec Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringSet

type StringSet map[string]struct{}

StringSet defines set that contains some string

func CopyStringSet

func CopyStringSet(set StringSet) StringSet

CopyStringSet deep copy a set and return the copied one

func CreateStringSet

func CreateStringSet(sl ...string) StringSet

CreateStringSet creates a stringset contains given strings

func NewStringSet

func NewStringSet() StringSet

NewStringSet Initialize a stringset

func (StringSet) Add

func (set StringSet) Add(s string)

Add adds a string to set

func (StringSet) Contains

func (set StringSet) Contains(s string) bool

Contains returns weather a string is in the set

func (StringSet) Difference

func (set1 StringSet) Difference(set2 StringSet) StringSet

Difference returns the different part of 2 sets

func (StringSet) Equals

func (set1 StringSet) Equals(set2 StringSet) bool

Equals returns weather 2 sets' elements are equal

func (StringSet) Intersection

func (set1 StringSet) Intersection(set2 StringSet) StringSet

Intersection returns the intersection part of 2 sets

func (StringSet) IsEmpty

func (set StringSet) IsEmpty() bool

IsEmpty returns weather the set is empty

func (StringSet) MarshalJSON

func (set StringSet) MarshalJSON() ([]byte, error)

MarshalJSON convert set to json

func (StringSet) Remove

func (set StringSet) Remove(s string)

Remove removes a string from set

func (*StringSet) Scan

func (set *StringSet) Scan(src interface{}) error

Scan implements the Scanner interface of gorm

func (StringSet) Size

func (set StringSet) Size() int

Size returns the length of a set

func (StringSet) String

func (set StringSet) String() string

String converts stringset to string type format like `[elem1 elem2 elem3]`

func (StringSet) ToSlice

func (set StringSet) ToSlice() []string

ToSlice convert StringSet to slice

func (StringSet) Union

func (set1 StringSet) Union(set2 StringSet) StringSet

Union returns the set contains set1's and set2's elements

func (*StringSet) UnmarshalJSON

func (set *StringSet) UnmarshalJSON(data []byte) error

UnmarshalJSON convert a json format bytes to stringset structure

func (*StringSet) Value

func (set *StringSet) Value() (driver.Value, error)

Value implements the Valuer interface of gorm

Jump to

Keyboard shortcuts

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