MCPcopy Create free account

hub / github.com/PacktPublishing/Go-Programming-Cookbook-Second-Edition / functions

Functions795 in github.com/PacktPublishing/Go-Programming-Cookbook-Second-Edition

↓ 2 callersMethodInit
Init sets the ordinal value can only be done once
chapter10/atomic/ordinal.go:23
↓ 2 callersFunctionLoadFile
LoadFile unmarshalls a json file into a config struct
chapter2/envvar/config.go:27
↓ 2 callersFunctionLogger
Logger is one of our 'middleware' decorators
chapter7/decorator/middleware.go:10
↓ 2 callersFunctionNewFSM
NewFSM creates a new FSM with start state of "first"
chapter11/consensus/fsm.go:17
↓ 2 callersFunctionNewMockAsyncProducer
(ctrl *gomock.Controller)
chapter12/asynckafka/producer/mocks_test.go:22
↓ 2 callersFunctionOriginalError
OriginalError returns the error original error
chapter4/log/error.go:7
↓ 2 callersFunctionPassThroughError
PassThroughError calls OriginalError and forwards the error along after wrapping.
chapter4/log/error.go:13
↓ 2 callersFunctionPatch
Patch sets the value pointed to by the given destination to the given value, and returns a function to restore it to its original value. The value mu
chapter9/mocking/patch.go:18
↓ 2 callersFunctionProcess
Process switches on operation type Then does work
chapter10/state/process.go:7
↓ 2 callersFunctionProcess
Process dispatches work to the worker pool channel
chapter10/pool/work.go:30
↓ 2 callersMethodProcess
Process does the encoding then pushes the result onto Res
chapter12/goflow/components.go:15
↓ 2 callersMethodProcessRequest
ProcessRequest modifies the request in accordnance with Proxy settings
chapter8/proxy/process.go:11
↓ 2 callersFunctionProcessResponse
Process response grabs results and errors from a producer asynchronously
chapter12/asynckafka/producer/producer.go:11
↓ 2 callersFunctionQuery
Query grabs a new connection creates tables, and later drops them and issues some queries
chapter6/database/query.go:13
↓ 2 callersFunctionQuery
Query grabs a new connection and issues some queries printing the results
chapter6/dbinterface/query.go:11
↓ 2 callersFunctionReadCSV
ReadCSV gives shows some examples of processing CSV that is passed in as an io.Reader
chapter1/csvformat/read_csv.go:20
↓ 2 callersFunctionReadItems
ReadItems returns our list of items in a thread-safe way
chapter14/fastweb/items.go:24
↓ 2 callersMethodRespond
Respond switches on Content Type to determine the response
chapter8/negotiate/respond.go:8
↓ 2 callersMethodRestore
Restore restores some previous state.
chapter9/mocking/patch.go:10
↓ 2 callersMethodSet
Set sets a value to a key, then returns the value
chapter8/grpcjson/internal/keyvalue.go:26
↓ 2 callersFunctionSetID
SetID updates context with the id then increments it
chapter8/middleware/context.go:18
↓ 2 callersFunctionSetup
Setup initializes our ClientInterface
chapter7/decorator/config.go:10
↓ 2 callersFunctionSetup
Setup return an oauth2Config configured to talk to github, you need environment variables set for your id and secret
chapter7/oauthcli/config.go:15
↓ 2 callersFunctionSetup
Setup initializes a mongo client
chapter11/orchestrate/config.go:13
↓ 2 callersFunctionSetup
Setup initializes a mongo client
chapter6/mongodb/config.go:12
↓ 2 callersFunctionSetup
Setup configures the db along with pools number of connections and more
chapter6/pools/pools.go:13
↓ 2 callersFunctionSetup
Setup sets some values
chapter10/context/values.go:13
↓ 2 callersMethodSetupMenu
SetupMenu initializes the base flags
chapter2/cmdargs/cmdargs.go:37
↓ 2 callersMethodString
()
chapter8/grpcjson/keyvalue/keyvalue.pb.go:84
↓ 2 callersMethodString
()
chapter2/flags/custom.go:13
↓ 2 callersMethodSuccesses
()
chapter12/asynckafka/producer/mocks_test.go:70
↓ 2 callersMethodToJSON
ToJSON dumps the JSONData struct to a JSON format bytes.Buffer
chapter2/confformat/json.go:18
↓ 2 callersMethodToTOML
ToTOML dumps the TOMLData struct to a TOML format bytes.Buffer
chapter2/confformat/toml.go:18
↓ 2 callersMethodToYAML
ToYAML dumps the YAMLData struct to a YAML format bytes.Buffer
chapter2/confformat/yaml.go:18
↓ 2 callersMethodTransition
Transition will move a state to the next state if able
chapter11/consensus/state.go:33
↓ 2 callersMethodVersion
Version prints the current version that is stored as a const
chapter2/cmdargs/cmdargs.go:69
↓ 2 callersFunctionWithField
WithField adds a log field to the context
chapter4/context/log.go:34
↓ 2 callersFunctionWithField
WithField exports the logs withfield connected to our global log
chapter4/global/global.go:40
↓ 2 callersFunctionWithFields
WithFields adds many log fields to the context
chapter4/context/log.go:39
↓ 2 callersFunctionWordCount
WordCount takes a file and returns a map with each word as a key and it's number of appearances as a value
chapter2/pipes/pipes.go:13
↓ 2 callersMethodWork
Work is how to dispatch a worker, they are assigned a job here
chapter10/pipeline/worker.go:26
↓ 2 callersFunctionWorker
Worker loops forever and is part of the worker pool
chapter10/pool/worker.go:23
↓ 2 callersFunctioncallRequestRouted
Call twirp.ServerHooks.RequestRouted if the hook is available
chapter7/twirp/rpc/greeter/greeter.twirp.go:719
↓ 2 callersFunctioncallResponsePrepared
Call twirp.ServerHooks.ResponsePrepared if the hook is available
chapter7/twirp/rpc/greeter/greeter.twirp.go:727
↓ 2 callersFunctioncompareWork
(wr WorkRequest)
chapter10/pool/crypto.go:14
↓ 2 callersFunctionerrorFromResponse
errorFromResponse builds a twirp.Error from a non-200 HTTP response. If the response has a valid serialized Twirp error, then it's returned. If not, t
chapter7/twirp/rpc/greeter/greeter.twirp.go:495
↓ 2 callersFunctiongatherLocation
(ctx context.Context)
chapter4/context/collect.go:35
↓ 2 callersFunctiongatherName
(ctx context.Context)
chapter4/context/collect.go:31
↓ 2 callersFunctionhashWork
(wr WorkRequest)
chapter10/pool/crypto.go:5
↓ 2 callersFunctionnewRequest
newRequest makes an http.Request from a client, adding common headers.
chapter7/twirp/rpc/greeter/greeter.twirp.go:446
↓ 2 callersMethodqueryMessages
(ctx context.Context, limit int)
chapter13/appengine/message.go:27
↓ 2 callersMethodstoreMessage
(ctx context.Context, message string)
chapter13/appengine/message.go:16
↓ 2 callersFunctiontoString
ToString is an example of taking an io.Reader and consuming it all, then returning a string
chapter1/bytestrings/buffer.go:32
↓ 2 callersFunctiontwirpErrorFromIntermediary
twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors. The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/
chapter7/twirp/rpc/greeter/greeter.twirp.go:535
↓ 2 callersFunctionurlBase
urlBase helps ensure that addr specifies a scheme. If it is unparsable as a URL, it returns addr unchanged.
chapter7/twirp/rpc/greeter/greeter.twirp.go:412
↓ 2 callersFunctionwithoutRedirects
The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or 303 response, and also 301s in go1.8. It redirects by m
chapter7/twirp/rpc/greeter/greeter.twirp.go:602
↓ 2 callersFunctionwriteError
writeError writes Twirp errors in the response and triggers hooks.
chapter7/twirp/rpc/greeter/greeter.twirp.go:373
↓ 1 callersFunctionAddItems
AddItems modifies our array
chapter14/fastweb/handlers.go:18
↓ 1 callersFunctionAddMoviesFromText
AddMoviesFromText uses the CSV parser with a string
chapter1/csvformat/read_csv.go:59
↓ 1 callersFunctionApex
Apex has a number of useful tricks
chapter4/structured/apex.go:31
↓ 1 callersFunctionApplyMiddleware
ApplyMiddleware will apply all middleware, the last arguments will be the outer wrap for context passing purposes
chapter8/middleware/middleware.go:14
↓ 1 callersMethodAsyncClose
()
chapter12/asynckafka/producer/mocks_test.go:32
↓ 1 callersFunctionAuthenticate
Authenticate grabs oauth scopes using a generated service_account.json file from https://console.firebase.google.com/project/go-cookbook/settings/serv
chapter13/firebase/auth.go:14
↓ 1 callersFunctionBase64Example
Base64Example demonstrates using the base64 package
chapter3/encoding/base64.go:12
↓ 1 callersFunctionBase64ExampleEncoder
Base64ExampleEncoder shows similar examples with encoders/decoders
chapter3/encoding/base64.go:33
↓ 1 callersFunctionBaseEncoding
BaseEncoding shows encoding and decoding with normal types
chapter3/nulls/base.go:23
↓ 1 callersFunctionBasicErrors
BasicErrors demonstrates some ways to create errors
chapter4/basicerrors/basicerrors.go:19
↓ 1 callersFunctionCapitalizerExample
CapitalizerExample creates two files, writes to one then calls Capitalizer() on both
chapter1/filedirs/files.go:33
↓ 1 callersMethodCause
()
chapter7/twirp/rpc/greeter/greeter.twirp.go:578
↓ 1 callersMethodCommit
()
chapter6/dbinterface/transaction.go:18
↓ 1 callersFunctionConfig
Config creates num in-memory raft nodes and connects them
chapter11/consensus/config.go:9
↓ 1 callersFunctionConvertPenniesToDollarString
ConvertPenniesToDollarString takes a penny amount as an int64 and returns a dollar string representation
chapter3/currency/pennies.go:9
↓ 1 callersFunctionConvertStringDollarsToPennies
ConvertStringDollarsToPennies takes a dollar amount as a string, i.e. 1.00, 55.12 etc and converts it into an int64
chapter3/currency/dollars.go:12
↓ 1 callersFunctionCopy
Copy copies data from in to out first directly, then using a buffer. It also writes to stdout
chapter1/interfaces/interfaces.go:11
↓ 1 callersFunctionCounterHandler
CounterHandler will update a counter each time it's called
chapter11/metrics/handler.go:11
↓ 1 callersFunctionCoverage
Coverage is a simple function with some brancing conditions
chapter9/coverage/coverage.go:6
↓ 1 callersFunctionCrawl
Crawl collects responses from a list of urls that are passed in. It waits for all requests to complete before returning.
chapter10/waitgroup/process.go:12
↓ 1 callersFunctionDefaultGetGolang
DefaultGetGolang uses the default client to get golang.org
chapter7/client/exec.go:22
↓ 1 callersFunctionDispatch
Dispatch creates numWorker workers, returns a cancel functionand channels for adding work and responses, cancel must be called
chapter10/pool/worker.go:10
↓ 1 callersFunctionDoOps
DoOps takes a client, then fetches google.com
chapter7/client/exec.go:10
↓ 1 callersFunctionDoSomeStuff
(d DoStuffer)
chapter9/mocking/exec.go:9
↓ 1 callersMethodDoStuff
(input string)
chapter9/mocking/mock.go:5
↓ 1 callersFunctionEmptyStruct
EmptyStruct demonstrates serialize and deserialize for an Empty struct with tags
chapter3/tags/tags.go:18
↓ 1 callersFunctionExamples
Examples demonstrates some of the functions in the math package
chapter3/math/math.go:10
↓ 1 callersFunctionExec
Exec creates a client, calls google.com then prints the response
chapter7/decorator/exec.go:7
↓ 1 callersFunctionExec
Exec creates an API Client and uses its GetGoogle method, then prints the result
chapter7/rest/exec.go:7
↓ 1 callersFunctionExec
Exec creates then queries an Example
chapter11/orchestrate/exec.go:17
↓ 1 callersFunctionExec
Exec creates a consul entry then queries it
chapter11/discovery/exec.go:6
↓ 1 callersFunctionExec
Exec creates then queries an Example
chapter6/mongodb/exec.go:17
↓ 1 callersFunctionExec
Exec takes a new connection creates tables, and later drops them and issues some queries
chapter6/database/exec.go:12
↓ 1 callersFunctionExec
Exec replaces the Exec from the previous recipe
chapter6/dbinterface/exec.go:5
↓ 1 callersFunctionExec
Exec performs some redis operations
chapter6/redis/exec.go:11
↓ 1 callersFunctionExec
Exec sets two random timers and prints a different context value for whichever fires first
chapter10/context/exec.go:13
↓ 1 callersFunctionExecWithTimeout
ExecWithTimeout will timeout trying to get the current time
chapter6/pools/timeout.go:10
↓ 1 callersFunctionFetchAll
FetchAll grabs a list of urls
chapter7/async/exec.go:4
↓ 1 callersFunctionFib
Fib prints the nth digit of the fibonacci sequence it will return 1 for anything < 0 as well... it's calculated recursively and use big.Int since int6
chapter3/math/fib.go:17
↓ 1 callersFunctionFilter
Filter is a functional filter. It takes a list of WorkWith and a WorkWith Function that returns a bool for each "true" element we return it to the res
chapter3/collections/collections.go:14
↓ 1 callersFunctionFinalDestination
FinalDestination deals with the error and doesn't forward it
chapter4/log/error.go:22
↓ 1 callersMethodFire
Fire will trigger whenever you log
chapter4/structured/logrus.go:12
↓ 1 callersFunctionFromContext
FromContext takes an entry and a context then returns an entry populated from the context object
chapter4/context/log.go:26
← previousnext →101–200 of 795, ranked by callers