Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PacktPublishing/Go-Programming-Cookbook-Second-Edition
/ functions
Functions
795 in github.com/PacktPublishing/Go-Programming-Cookbook-Second-Edition
⨍
Functions
795
◇
Types & classes
269
↓ 1 callers
Function
FullStruct
FullStruct demonstrates serialize and deserialize for an Full struct with tags
chapter3/tags/tags.go:39
↓ 1 callers
Method
Get
Get gets a value given a key, or say not found if it doesn't exist
chapter8/grpcjson/internal/keyvalue.go:35
↓ 1 callers
Method
GetByName
(context.Context, string)
chapter6/storage/storage.go:16
↓ 1 callers
Method
GetGreeting
()
chapter7/twirp/rpc/greeter/greeter.pb.go:53
↓ 1 callers
Method
GetGreeting
()
chapter7/grpc/greeter/greeter.pb.go:47
↓ 1 callers
Method
GetHandler
GetHandler wraps our RPC Get call
chapter8/grpcjson/http/get.go:14
↓ 1 callers
Function
GetItems
GetItems will return our items object
chapter14/fastweb/handlers.go:10
↓ 1 callers
Method
GetName
()
chapter7/twirp/rpc/greeter/greeter.pb.go:60
↓ 1 callers
Method
GetName
()
chapter7/grpc/greeter/greeter.pb.go:54
↓ 1 callers
Method
GetThenSet
GetThenSet checks if a value is set. If not it sets it.
chapter9/mockgen/exec.go:11
↓ 1 callers
Function
GetToken
GetToken retrieves a github oauth2 token
chapter7/oauthstore/storage.go:17
↓ 1 callers
Function
GetToken
GetToken retrieves a github oauth2 token
chapter7/oauthcli/config.go:25
↓ 1 callers
Function
GobExample
GobExample demonstrates using the gob package
chapter3/encoding/gob.go:19
↓ 1 callers
Method
Greet
Greet implements twirp Greet
chapter7/twirp/server/greeter.go:17
↓ 1 callers
Method
Greet
Greet implements grpc Greet
chapter7/grpc/server/greeter.go:17
↓ 1 callers
Function
GreetingHandler
GreetingHandler returns a GreetingResponse which either has errors or a useful payload
chapter8/handlers/post.go:21
↓ 1 callers
Function
GuessHandler
GuessHandler checks if ?message=password
chapter14/pprof/crypto/handler.go:10
↓ 1 callers
Function
HTMLDifferences
HTMLDifferences highlights some of the differences between html/template and text/template
chapter1/templates/html_templates.go:11
↓ 1 callers
Method
HandleLog
HandleLog adds a hook and does the emitting
chapter4/structured/apex.go:25
↓ 1 callers
Function
Handler
Handler grabs the get param ?next= and tries to transition to the state contained there
chapter11/consensus/handler.go:10
↓ 1 callers
Function
Handler
Handler is very basic
chapter8/middleware/handler.go:8
↓ 1 callers
Function
Handler
Handler gets a negotiator using the request, then renders a Payload
chapter8/negotiate/handler.go:16
↓ 1 callers
Function
Handler
Handler takes a request and renders a response
chapter9/bdd/handler.go:16
↓ 1 callers
Function
HelloHandler
HelloHandler takes a GET parameter "name" and responds with Hello <name>! in plaintext
chapter8/handlers/get.go:10
↓ 1 callers
Function
IncrementVersion
IncrementVersion increments a WorkWiths Version
chapter3/collections/functions.go:14
↓ 1 callers
Function
InitTemplates
InitTemplates sets up templates from a directory
chapter1/templates/template_files.go:16
↓ 1 callers
Function
Initialize
Initialize calls 3 functions to set up, then logs before terminating
chapter4/context/collect.go:13
↓ 1 callers
Method
Input
()
chapter12/asynckafka/producer/mocks_test.go:60
↓ 1 callers
Function
Interfaces
Interfaces demonstrates casting from anonymous interfaces to types
chapter3/dataconv/interfaces.go:20
↓ 1 callers
Method
Levels
Levels is what levels this hook will fire on
chapter4/structured/logrus.go:18
↓ 1 callers
Function
LoadConfig
LoadConfig will load files optionally from the json file stored at path, then will override those values based on the envconfig struct tags. The envPr
chapter2/envvar/config.go:15
↓ 1 callers
Function
Log
Log uses the setup logger
chapter4/log/log.go:10
↓ 1 callers
Function
Logger
Logger logs requests, this will use an id passed in via SetID()
chapter8/middleware/middleware.go:24
↓ 1 callers
Function
Logrus
Logrus demonstrates some basic logrus functionality
chapter4/structured/logrus.go:23
↓ 1 callers
Function
LookupAddress
LookupAddress returns a DNSLookup consisting of a cname and host for a given address
chapter5/dns/dns.go:27
↓ 1 callers
Function
LowerCaseData
LowerCaseData does a ToLower to the Data string of a WorkWith
chapter3/collections/functions.go:7
↓ 1 callers
Function
Map
Map is a functional map. It takes a list of WorkWith and a WorkWith Function that takes a WorkWith and returns a modified WorkWith. The end result is
chapter3/collections/collections.go:30
↓ 1 callers
Function
MarshalAll
MarshalAll takes some data stored in structs and converts them to the various data formats
chapter2/confformat/marshal.go:7
↓ 1 callers
Function
ModifyString
ModifyString modifies a string in a number of ways
chapter1/bytestrings/string.go:31
↓ 1 callers
Function
New
New initializes a controller with our local validation, it can be overwritten
chapter8/validation/controller.go:10
↓ 1 callers
Function
NewEncodingApp
NewEncodingApp wires together the components
chapter12/goflow/network.go:8
↓ 1 callers
Function
NewKeyValue
NewKeyValue initializes the KeyValue struct and its map
chapter8/grpcjson/internal/keyvalue.go:19
↓ 1 callers
Function
NewMockDB
(ctrl *gomock.Controller)
chapter6/dbinterface/mocks_test.go:23
↓ 1 callers
Function
NewMongoStorage
NewMongoStorage initializes a MongoStorage
chapter6/storage/mongoconfig.go:18
↓ 1 callers
Function
NewOrdinal
NewOrdinal returns ordinal with once setup
chapter10/atomic/ordinal.go:17
↓ 1 callers
Function
NewSafeMap
NewSafeMap creates a SafeMap
chapter10/atomic/map.go:16
↓ 1 callers
Function
NewUpperApp
NewUpperApp wires together the compoents
chapter12/kafkaflow/network.go:6
↓ 1 callers
Function
NullEncoding
NullEncoding shows an alternative method for dealing with nil/omitted values
chapter3/nulls/nullencoding.go:36
↓ 1 callers
Function
OldVersion
OldVersion returns a closures that validates the version is greater than the specified amount
chapter3/collections/functions.go:22
↓ 1 callers
Function
Operate
Operate manipulates files and directories
chapter1/filedirs/dirs.go:10
↓ 1 callers
Function
OtherJSONExamples
OtherJSONExamples shows ways to use types beyond structs and other useful functions
chapter2/confformat/json.go:36
↓ 1 callers
Function
Panic
Panic panics with a divide by zero
chapter4/panic/panic.go:9
↓ 1 callers
Function
PerformOperations
PerformOperations creates a candle item then gets it
chapter6/storage/exec.go:29
↓ 1 callers
Function
PipeExample
PipeExample helps give some more examples of using io interfaces
chapter1/interfaces/pipes.go:9
↓ 1 callers
Function
PointerEncoding
PointerEncoding shows methods for dealing with nil/omitted values
chapter3/nulls/pointer.go:17
↓ 1 callers
Method
Present
Present can be used to determine if we should return this
chapter10/waitgroup/tasks.go:38
↓ 1 callers
Function
Printer
Printer will print anything sent on the ch chan and will print tock every 200 milliseconds this will repeat forever until a context is Done, i.e. time
chapter10/channels/printer.go:13
↓ 1 callers
Method
Process
Process Prints the current line received
chapter12/goflow/components.go:28
↓ 1 callers
Method
Process
Process is a handler that validates a post payload
chapter8/validation/process.go:10
↓ 1 callers
Function
Processor
Processor routes work to Process
chapter10/state/processor.go:6
↓ 1 callers
Function
ReportHandler
ReportHandler will emit the current metrics in json format
chapter11/metrics/report.go:10
↓ 1 callers
Function
Resolve
Resolve handles filtering cards by suit and value
chapter12/graphql/cards/resolve.go:11
↓ 1 callers
Method
Rollback
()
chapter6/dbinterface/transaction.go:19
↓ 1 callers
Method
RoundTrip
RoundTrip Implements RoundTripper interface
chapter7/client/client.go:34
↓ 1 callers
Method
RoundTrip
RoundTrip does the basic auth before deferring to the default transport
chapter7/rest/transport.go:14
↓ 1 callers
Function
RunTemplate
RunTemplate initializes a template and demonstrates a variety of template helper functions
chapter1/templates/templates.go:49
↓ 1 callers
Function
SearchString
SearchString shows a number of methods for searching a string
chapter1/bytestrings/string.go:12
↓ 1 callers
Function
Sender
Sender sends "tick"" on ch until done is written to, then it sends "sender done." and exits
chapter10/channels/sender.go:8
↓ 1 callers
Method
ServeHTTP
ServeHTTP means that proxy implments the Handler interface It manipulates the request, forwards it to BaseURL, then returns the response
chapter8/proxy/proxy.go:18
↓ 1 callers
Function
SetLog
SetLog sets the log
chapter4/global/global.go:34
↓ 1 callers
Method
SetValue
SetValue modifies the underlying storage of the controller object
chapter8/controllers/post.go:9
↓ 1 callers
Function
Setup
Setup prepares and returns our card schema
chapter12/graphql/cards/schema.go:7
↓ 1 callers
Function
Setup
Setup configures and returns our database connection poold
chapter6/database/config.go:20
↓ 1 callers
Function
ShowConv
ShowConv demonstrates some type conversion
chapter3/dataconv/dataconv.go:6
↓ 1 callers
Function
SomeFunc
SomeFunc returns an error
chapter4/basicerrors/custom.go:18
↓ 1 callers
Function
Sort
Sort performs a sort redis operations
chapter6/redis/sort.go:10
↓ 1 callers
Function
StackTrace
StackTrace will print all the stack for the error
chapter4/errwrap/unwrap.go:29
↓ 1 callers
Function
Strconv
Strconv demonstrates some strconv functions
chapter3/dataconv/strconv.go:10
↓ 1 callers
Method
String
()
chapter7/twirp/rpc/greeter/greeter.pb.go:30
↓ 1 callers
Function
StringReader
StringReader demonstrates how to create an io.Reader interface quickly with a string
chapter1/bytestrings/string.go:48
↓ 1 callers
Function
TimerHandler
TimerHandler records the duration required to compelete
chapter11/metrics/handler.go:20
↓ 1 callers
Method
Token
Token satisfies the TokenSource interface
chapter7/oauthstore/tokensource.go:15
↓ 1 callers
Method
Tweak
Tweak conforms to the RPC library which require: - the method's type is exported. - the method is exported. - the method has two arguments, both expor
chapter5/rpc/tweak/tweak.go:25
↓ 1 callers
Function
UnmarshalAll
UnmarshalAll takes data in various formats and converts them into structs
chapter2/confformat/unmarshal.go:19
↓ 1 callers
Function
Unwrap
Unwrap will unwrap an error and do type assertion to it
chapter4/errwrap/unwrap.go:11
↓ 1 callers
Function
UseLog
UseLog demonstrates using our global log
chapter4/global/log.go:5
↓ 1 callers
Function
ValidatePayload
ValidatePayload is 1 implementation of the closure in our controller
chapter8/validation/validate.go:21
↓ 1 callers
Function
VersionHandler
VersionHandler writes the latest version info
chapter11/docker/version.go:18
↓ 1 callers
Function
WorkWithBuffer
WorkWithBuffer will make use of the buffer created by the Buffer function
chapter1/bytestrings/bytes.go:11
↓ 1 callers
Function
WorkWithTemp
WorkWithTemp will give some basic patterns for working with temporary files and directories
chapter1/tempfiles/temp_files.go:11
↓ 1 callers
Function
Wrap
Wrap shows what happens when we wrap an error
chapter4/errwrap/errwrap.go:21
↓ 1 callers
Function
WriteCSVBuffer
WriteCSVBuffer returns a buffer csv for a set of books
chapter1/csvformat/write_csv.go:57
↓ 1 callers
Function
WriteCSVOutput
WriteCSVOutput initializes a set of books and writes the to os.Stdout
chapter1/csvformat/write_csv.go:40
↓ 1 callers
Function
broadcast
(conn *net.UDPConn, conns *connections)
chapter5/udp/server/broadcast.go:16
↓ 1 callers
Function
callRequestReceived
Call twirp.ServerHooks.RequestReceived if the hook is available
chapter7/twirp/rpc/greeter/greeter.twirp.go:711
↓ 1 callers
Function
catchSig
catchSig cleans up our websocket conenction if we kill the program with a ctrl-c
chapter5/websocket/client/main.go:13
↓ 1 callers
Function
doJSONRequest
doJSONRequest is common code to make a request to the remote twirp service.
chapter7/twirp/rpc/greeter/greeter.twirp.go:666
↓ 1 callers
Function
doProtobufRequest
doProtobufRequest is common code to make a request to the remote twirp service.
chapter7/twirp/rpc/greeter/greeter.twirp.go:617
↓ 1 callers
Function
echoBackCapitalized
(conn net.Conn)
chapter5/tcp/server/main.go:12
↓ 1 callers
Function
example
()
chapter9/tools/funcs.go:7
← previous
next →
201–300 of 795, ranked by callers