hi

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

package hi exposes a few Go functions to be wrapped and used from Python.

Index

Constants

View Source
const (
	Version  = "0.1" // Version of this package
	Universe = 42    // Universe is the fundamental constant of everything
)

Variables

View Source
var (
	Debug    = false                            // Debug switches between debug and prod
	Anon     = Person{Age: 1, Name: "<nobody>"} // Anon is a default anonymous person
	IntSlice = []int{1, 2}                      // A slice of ints
	IntArray = [2]int{1, 2}                     // An array of ints
)

Functions

func Add

func Add(i, j int) int

Add returns the sum of its arguments.

func Concat

func Concat(s1, s2 string) string

Concat concatenates two strings together and returns the resulting string.

func Hello

func Hello(s string)

Hello prints a greeting from Go

func Hi

func Hi()

Hi prints hi from Go

func LookupQuestion

func LookupQuestion(n int) (string, error)

LookupQuestion returns question for given answer.

Types

type Couple

type Couple struct {
	P1 Person
	P2 Person
}

Couple is a pair of persons

func NewCouple

func NewCouple(p1, p2 Person) Couple

NewCouple returns a new couple made of the p1 and p2 persons.

func (*Couple) String

func (c *Couple) String() string

type Eval

type Eval func(f float64) float64

Eval evals float64

type Float

type Float float32

Float is a kind of float32

type Floats

type Floats []Float

Floats is a slice of floats

type PersIface added in v0.4.3

type PersIface interface {
	// GetName returns the name of the person
	GetName() string

	// GetAge returns the age of the person
	GetAge() int

	// SetName sets name
	SetName(n string)

	// SetAge sets age
	SetAge(age int)

	// Greet sends greetings
	Greet() string
}

PersIface is an interface into the person type.

func PersonAsIface added in v0.4.3

func PersonAsIface(name string, age int) PersIface

PersonAsIface creates a new person as a PersIface interface

type Person

type Person struct {
	Name string
	Age  int
}

Person is a simple struct

func NewActivePerson

func NewActivePerson(h int) (*Person, error)

NewActivePerson creates a new Person with a certain amount of work done.

func NewPerson

func NewPerson(name string, age int) *Person

NewPerson creates a new Person value

func NewPersonWithAge

func NewPersonWithAge(age int) *Person

NewPersonWithAge creates a new Person with a specific age

func (*Person) GetAge added in v0.4.3

func (p *Person) GetAge() int

func (*Person) GetName added in v0.4.3

func (p *Person) GetName() string

func (*Person) Greet

func (p *Person) Greet() string

Greet sends greetings

func (*Person) ReturnS2Ptr added in v0.4.3

func (p *Person) ReturnS2Ptr() *structs.S2

func (*Person) Salary

func (p *Person) Salary(h int) (int, error)

Salary returns the expected gains after h hours of work

func (*Person) SetAge added in v0.4.3

func (p *Person) SetAge(age int)

func (*Person) SetFmS2 added in v0.4.3

func (p *Person) SetFmS2(s2 structs.S2)

func (*Person) SetFmS2Ptr added in v0.4.3

func (p *Person) SetFmS2Ptr(s2 *structs.S2)

func (*Person) SetName added in v0.4.3

func (p *Person) SetName(n string)

func (Person) String

func (p Person) String() string

func (*Person) Work

func (p *Person) Work(h int) error

Work makes a Person go to work for h hours

Jump to

Keyboard shortcuts

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