hi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: BSD-3-Clause Imports: 2 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 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) Greet

func (p *Person) Greet() string

Greet sends greetings

func (*Person) Salary

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

Salary returns the expected gains after h hours of work

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