set

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 3 Imported by: 0

README

Package set

set.

Usage

package main

import (
	"log"

	"github.com/QisFj/godry/set"
)

func main() {
	log.Println("Int Set:")
	intSet()
	log.Println("String Set:")
	stringSet()
}

func intSet() {
	s := set.Int{}
	s.Add(1, 1, 1, 2, 2, 2)
	log.Printf("set list: %v\n", s.List())
}

func stringSet() {
	s := set.String{}
	s.Add("1", "1", "1", "2", "2", "2")
	log.Printf("set list: %v\n", s.List())
}

Documentation

Overview

Code generated by go generate; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var MarshalOrder = 0

MarshalOrder can change the order of the elements when marshaling. 1 for desc 2 for asc 0 or other value for no certain order

Functions

This section is empty.

Types

type Int

type Int map[int]struct{}

func FromInts added in v0.1.11

func FromInts(es ...int) Int

func IntDiff

func IntDiff(set1, set2 Int) (both, only1, only2 Int)

func IntMerge

func IntMerge(set1, set2 Int) Int

func (*Int) Add

func (set *Int) Add(es ...int)

func (Int) Contains

func (set Int) Contains(e int) bool

func (Int) ContainsAll

func (set Int) ContainsAll(es ...int) bool

func (Int) ContainsAny

func (set Int) ContainsAny(es ...int) bool

func (Int) List

func (set Int) List() []int

func (Int) MarshalJSON added in v0.1.11

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

func (*Int) UnmarshalJSON added in v0.1.11

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

type String

type String map[string]struct{}

func FromStrings added in v0.1.11

func FromStrings(es ...string) String

func StringDiff

func StringDiff(set1, set2 String) (both, only1, only2 String)

func StringMerge

func StringMerge(set1, set2 String) String

func (*String) Add

func (set *String) Add(es ...string)

func (String) Contains

func (set String) Contains(e string) bool

func (String) ContainsAll

func (set String) ContainsAll(es ...string) bool

func (String) ContainsAny

func (set String) ContainsAny(es ...string) bool

func (String) List

func (set String) List() []string

func (String) MarshalJSON added in v0.1.11

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

func (*String) UnmarshalJSON added in v0.1.11

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

type T

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

func NewT

func NewT(t reflect.Type) T

func TDiff

func TDiff(set1, set2 T) (both, only1, only2 T)

func TMerge

func TMerge(set1, set2 T) T

func (*T) Add

func (set *T) Add(es ...interface{})

func (T) Contains

func (set T) Contains(e interface{}) bool

func (T) ContainsAll

func (set T) ContainsAll(es ...interface{}) bool

func (T) ContainsAny

func (set T) ContainsAny(es ...interface{}) bool

func (T) List

func (set T) List() interface{}

func (*T) New

func (set *T) New(t reflect.Type)

type Uint

type Uint map[uint]struct{}

func FromUints added in v0.1.11

func FromUints(es ...uint) Uint

func UintDiff

func UintDiff(set1, set2 Uint) (both, only1, only2 Uint)

func UintMerge

func UintMerge(set1, set2 Uint) Uint

func (*Uint) Add

func (set *Uint) Add(es ...uint)

func (Uint) Contains

func (set Uint) Contains(e uint) bool

func (Uint) ContainsAll

func (set Uint) ContainsAll(es ...uint) bool

func (Uint) ContainsAny

func (set Uint) ContainsAny(es ...uint) bool

func (Uint) List

func (set Uint) List() []uint

func (Uint) MarshalJSON added in v0.1.11

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

func (*Uint) UnmarshalJSON added in v0.1.11

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

Jump to

Keyboard shortcuts

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