test

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a int, b int) int

func Compare

func Compare(t1 Test, t2 Test) int

func ComputeAsync

func ComputeAsync(a int, b int, callback func(a int, b int) int) int

func Divide

func Divide(a int, b int) float64

func GetByIndex added in v1.1.1

func GetByIndex[T any](arr []T, index int) *T

func Hello

func Hello(s string) string

func Index added in v1.1.1

func Index(arr []any, item any) int

func Len added in v1.1.1

func Len(arr []int) int

func Minus

func Minus(a int64, b int64) int64

func Multiply

func Multiply(a float32, b float32) float64

func ReplyTo added in v1.1.0

func ReplyTo(c Comment, c2 Comment) bool

func SetByIndex added in v1.1.1

func SetByIndex[T any](arr []T, index int, item T)

func TestGeneric added in v1.1.0

func TestGeneric[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64, R int | float64](a T, b R) float64

func TestInterfaceCallback

func TestInterfaceCallback(a int, callback Callback)

Types

type Callback

type Callback interface {
	OnSuccess(data any)
	OnFailure(err error)
}

type CallbackImpl

type CallbackImpl struct {
}

func (CallbackImpl) OnFailure

func (test CallbackImpl) OnFailure(err error)

func (CallbackImpl) OnSuccess

func (test CallbackImpl) OnSuccess(data any)

type Comment added in v1.1.0

type Comment struct {
	Id      int
	ToId    int
	Content string
	UserId  int
	Date    int64
	User    User
}

func (Comment) GetPublisher added in v1.1.0

func (comment Comment) GetPublisher(c Comment) User

func (*Comment) Reply added in v1.1.0

func (comment *Comment) Reply(c Comment) bool

type Test

type Test struct {
	Id   int
	Name string
}

func New

func New() Test

func (*Test) GetId

func (test *Test) GetId() int

func (*Test) GetName

func (test *Test) GetName() string

func (Test) OnFailure

func (test Test) OnFailure(err error)

func (Test) OnSuccess

func (test Test) OnSuccess(data any)

func (*Test) SetId

func (test *Test) SetId(id int)

func (*Test) SetName

func (test *Test) SetName(name string)

func (*Test) String

func (test *Test) String() string

type User added in v1.1.0

type User struct {
	Id        int
	Name      string
	Sex       int
	Certified bool
	Balance   float64
	Date      int64
}

func (*User) AddBalance added in v1.1.0

func (user *User) AddBalance(amount float64)

Jump to

Keyboard shortcuts

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