mlish

package module
v0.0.0-...-6c4835b Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Settings = &Setting{
	Out: os.Stdout,
}

Functions

func Remove

func Remove[T any](model *Model[T])

Types

type ForParams

type ForParams[T any] struct {
	// contains filtered or unexported fields
}

func (*ForParams[T]) Append

func (fp *ForParams[T]) Append(newItem *T)

func (*ForParams[T]) Data

func (fp *ForParams[T]) Data() T

func (*ForParams[T]) DataAddr

func (fp *ForParams[T]) DataAddr() *T

<!> Should not use to set data.

use `return` or `[].Add()` or `[].Append()`

func (*ForParams[T]) Index

func (fp *ForParams[T]) Index() int

type Model

type Model[T any] struct {
	// contains filtered or unexported fields
}

func Migrate

func Migrate[oldType any, newType any](
	model *Model[oldType],
	migrateCb func(item *ForParams[oldType]) *newType,
) *Model[newType]

func NewModel

func NewModel[T any]() *Model[T]

func (*Model[T]) Add

func (m *Model[T]) Add(data ...*T)

func (*Model[T]) Filter

func (m *Model[T]) Filter(cb func(item *ForParams[T]) *T) (filteredModel *Model[T])

func (*Model[T]) FilterByRegex

func (m *Model[T]) FilterByRegex(regex string, cb func(item *ForParams[T]) string) (filteredModel *Model[T])

func (*Model[T]) For

func (m *Model[T]) For(
	cb func(
		item *ForParams[T],
	),
)

func (*Model[T]) ForEach

func (m *Model[T]) ForEach(
	cb func(
		item *ForParams[T],
	) *T,
)

func (*Model[T]) Just

func (m *Model[T]) Just() []*T

func (*Model[T]) JustCopy

func (m *Model[T]) JustCopy() *Model[T]

func (*Model[T]) JustFor

func (m *Model[T]) JustFor(
	cb func(
		item *ForParams[T],
	),
) []*T

func (*Model[T]) JustForEach

func (m *Model[T]) JustForEach(
	cb func(
		item *ForParams[T],
	) *T,
) []*T

func (*Model[T]) Push

func (m *Model[T]) Push(w io.Writer, cb func(item *ForParams[T]) []byte)

type QueryString

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

func (QueryString) Replace

func (qs QueryString) Replace(replaceTo string)

type Setting

type Setting struct {
	DebugMode bool
	Out       io.Writer
}

type String

type String string

func NewString

func NewString() *String

func (*String) Get

func (s *String) Get() string

func (*String) Query

func (s *String) Query(pattern string) *QueryString

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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