GoReflectionTalk

module
v0.0.0-...-51ba627 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2016 License: Apache-2.0

README

Reflection - Standard Library

Developers are often told reflection is bad and should be avoided. However, when reflection can help reduce the amount of code needed to solve a problem, it should be considered. Reducing complexity while preserving maintainability must always be a priority. Reflection can be a tool that helps makes this possible. In this talk I am going to show you the power and elegance of the reflection package.

https://candysmurf.github.io/GoReflectionTalk

http://blog.golang.org/laws-of-reflection

Code Review

Basics

Example shows how to reflect over a struct type value.
Struct Types (Go Playground)

Example shows how to reflect over a slice of struct type values.
Slices (Go Playground)

Example shows how to reflect over a map of struct type values.
Maps (Go Playground)

Example shows how to reflect over a struct type pointer.
Pointers (Go Playground)

Interfaces

Example shows how to reflect over a struct type value that is stored inside an interface value.
Struct Types (Go Playground)

Example shows how to reflect over a slice of struct type values that are stored inside an interface value.
Slices (Go Playground)

Example shows how to reflect over a map of struct type values that are stored inside an interface value.
Maps (Go Playground)

Example shows how to reflect over a struct type pointer that is stored inside an interface value.
Pointers (Go Playground)

Inspection / Decoding

Example shows how to inspect a structs fields and display the field name, type and value.
Struct Types (Go Playground)

Example shows how to use reflection to decode an integer.
Integers (Go Playground)


All material is licensed under the Apache License Version 2.0, June 2016.

Directories

Path Synopsis
code
basics/map command
Example shows how to reflect over a map of struct type values.
Example shows how to reflect over a map of struct type values.
basics/pointer command
Example shows how to reflect over a struct type pointer.
Example shows how to reflect over a struct type pointer.
basics/slice command
Example shows how to reflect over a slice of struct type values.
Example shows how to reflect over a slice of struct type values.
basics/struct command
Example shows how to reflect over a struct type value.
Example shows how to reflect over a struct type value.
inspect/integer command
Example shows how reflection provides integrity.
Example shows how reflection provides integrity.
inspect/struct command
Example shows how reflection provides readability and simplicity.
Example shows how reflection provides readability and simplicity.
interface/map command
Example shows how to reflect over a map of struct type values that are stored inside an interface value.
Example shows how to reflect over a map of struct type values that are stored inside an interface value.
interface/pointer command
Example shows how to reflect over a struct type pointer that is stored inside an interface value.
Example shows how to reflect over a struct type pointer that is stored inside an interface value.
interface/slice command
Example shows how to reflect over a slice of struct type values that are stored inside an interface value.
Example shows how to reflect over a slice of struct type values that are stored inside an interface value.
interface/struct command
Example shows how to reflect over a struct type value that is stored inside an interface value.
Example shows how to reflect over a struct type value that is stored inside an interface value.

Jump to

Keyboard shortcuts

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