万本电子书0元读

万本电子书0元读

顶部广告

Go Standard Library Cookbook电子书

售       价:¥

23人正在读 | 0人评论 9.8

作       者:Radomír Sohlich

出  版  社:Packt Publishing

出版时间:2018-02-27

字       数:27.0万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Implement solutions by leveraging the power of the GO standard library and reducing dependency on external crates About This Book ? Develop high quality, fast and portable applications by leveraging the power of Go Standard Library. ? Practical recipes that will help you work with the standard library algorithms to boost your productivity as a Go developer. ? Compose your own algorithms without forfeiting the simplicity and elegance of the Standard Library. Who This Book Is For This book is for Go developers who would like to explore the power of Golang and learn how to use the Go standard library for various functionalities. The book assumes basic Go programming knowledge. What You Will Learn ? Access environmental variables ? Execute and work with child processes ? Manipulate strings by performing operations such as search, concatenate, and so on ? Parse and format the output of date/time information ? Operate on complex numbers and effective conversions between different number formats and bases ? Work with standard input and output ? Handle filesystem operations and file permissions ? Create TCP and HTTP servers, and access those servers with a client ? Utilize synchronization primitives ? Test your code In Detail Google's Golang will be the next talk of the town, with amazing features and a powerful library. This book will gear you up for using golang by taking you through recipes that will teach you how to leverage the standard library to implement a particular solution. This will enable Go developers to take advantage of using a rock-solid standard library instead of third-party frameworks. The book begins by exploring the functionalities available for interaction between the environment and the operating system. We will explore common string operations, date/time manipulations, and numerical problems. We'll then move on to working with the database, accessing the filesystem, and performing I/O operations. From a networking perspective, we will touch on client and server-side solutions. The basics of concurrency are also covered, before we wrap up with a few tips and tricks. By the end of the book, you will have a good overview of the features of the Golang standard library and what you can achieve with them. Ultimately, you will be proficient in implementing solutions with powerful standard libraries. Style and approach Solution based approach showcasing the power of Go standard library for easy practical implementations.
目录展开

Title Page

Copyright and Credits

Go Standard Library Cookbook

Packt Upsell

Why subscribe?

PacktPub.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Conventions used

Sections

Getting ready

How to do it…

How it works…

There's more…

See also

Get in touch

Reviews

Interacting with the Environment

Introduction

Retrieving the Golang version

Getting ready

How to do it...

How it works...

Accessing program arguments

How to do it...

How it works...

There's more…

Creating a program interface with the flag package

How to do it...

How it works…

There's more…

Getting and setting environment variables with default values

How to do it…

How it works…

Retrieving the current working directory

How to do it...

How it works…

Getting the current process PID

How to do it…

How it works…

Handling operating system signals

How to do it…

How it works…

Calling an external process

Getting ready

How to do it…

How it works…

See also

Retrieving child process information

Getting ready

How to do it…

How it works…

See also

Reading/writing from the child process

Getting ready

How to do it…

How it works…

Shutting down the application gracefully

How to do it…

How it works…

See also

File configuration with functional options

How to do it...

How it works...

Strings and Things

Introduction

Finding the substring in a string

How to do it...

How it works...

See also

Breaking the string into words

How to do it...

How it works...

There's more...

Joining the string slice with a separator

How to do it...

How it works...

There's more...

Concatenating a string with writer

How to do it...

How it works...

There's more...

Aligning text with tabwriter

How to do it...

How it works...

Replacing part of the string

How to do it...

How it works...

There's more...

Finding the substring in text by the regex pattern

How to do it...

How it works...

See also

Decoding a string from the non-Unicode charset

How to do it...

How it works...

Controlling case

How to do it...

How it works...

Parsing comma-separated data

How to do it...

How it works...

Managing whitespace in a string

How to do it...

How it works...

See also

Indenting a text document

How to do it...

How it works...

See also

Dealing with Numbers

Introduction

Converting strings to numbers

How to do it...

How it works...

Comparing floating-point numbers

How to do it...

How it works...

Rounding floating-point numbers

How to do it...

How it works...

Floating-point arithmetics

How to do it...

How it works...

There's more...

See also

Formatting numbers

How to do it...

How it works...

There's more...

Converting between binary, octal, decimal, and hexadecimal

How to do it...

How it works...

Formatting with the correct plurals

Getting ready

How to do it...

How it works...

There's more...

Generating random numbers

How to do it...

How it works...

Operating complex numbers

How to do it...

How it works...

Converting between degrees and radians

How to do it...

How it works...

Taking logarithms

How to do it...

How it works...

Generating checksums

How to do it...

How it works...

Once Upon a Time

Introduction

Finding today's date

How to do it...

How it works...

See also

Formatting date to string

How to do it...

How it works...

See also

Parsing the string into date

How to do it...

How it works...

Converting dates to epoch and vice versa

How to do it...

How it works...

Retrieving time units from the date

How to do it...

How it works...

Date arithmetics

How to do it...

How it works...

Finding the difference between two dates

How to do it...

How it works...

Converting between time zones

How to do it...

How it works...

Running the code block periodically

How to do it...

How it works...

Waiting a certain amount of time

How to do it...

How it works...

Timeout long-running operations

How to do it...

How it works...

There's more...

Serializing the time and date

How to do it...

How it works...

In and Out

Introduction

Reading standard input

How to do it...

How it works...

Writing standard output and error

How to do it...

How it works...

Opening a file by name

How to do it...

How it works...

Reading the file into a string

How to do it...

How it works...

Reading/writing a different charset

How to do it...

How it works...

See also

Seeking a position within a file

How to do it...

How it works...

Reading and writing binary data

How to do it...

How it works...

Writing to multiple writers at once

How to do it...

How it works...

Piping between writer and reader

How to do it...

How it works...

Serializing objects to binary format

How to do it...

How it works...

Reading and writing ZIP files

How to do it...

How it works...

Parsing a large XML file effectively

How to do it...

How it works...

Extracting data from an incomplete JSON array

How to do it...

How it works...

Discovering the Filesystem

Introduction

Getting file information

How to do it...

How it works...

Creating temporary files

How to do it...

How it works...

Writing the file

How to do it...

How it works...

Writing the file from multiple goroutines

How to do it...

How it works...

Listing a directory

How to do it...

How it works...

Changing file permissions

How to do it...

How it works...

Creating files and directories

How to do it...

How it works...

Filtering file listings

How to do it...

How it works...

See also

Comparing two files

How to do it...

How it works...

Resolving the user home directory

How to do it...

How it works...

Connecting the Network

Introduction

Resolving local IP addresses

How to do it...

How it works...

Connecting to the remote server

How to do it...

How it works...

Resolving the domain by IP address and vice versa

How to do it...

How it works...

Connecting to the HTTP server

How to do it...

How it works...

See also

Parsing and building a URL

How to do it...

How it works...

Creating an HTTP request

How to do it...

How it works...

Reading and writing HTTP headers

How to do it...

How it works...

Handling HTTP redirects

How to do it...

How it works...

Consuming the RESTful API

How to do it...

How it works...

Sending a simple email

Getting ready

How to do it...

How it works...

Calling the JSON-RPC service

How to do it...

How it works...

Working with Databases

Introduction

Connecting the database

Getting ready

How to do it...

How it works...

Validating the connection

Getting ready

How to do it...

How it works...

Executing statements

Getting ready

How to do it...

How it works...

Operations with prepared statements

Getting ready

How to do it...

How it works...

Canceling the pending query

Getting ready

How to do it...

How it works...

Reading query result metadata

Getting ready

How to do it...

How it works...

Retrieving data from a query result

Getting ready

How to do it...

How it works...

Parsing the query result into a map

Getting ready

How to do it...

How it works...

Handling transactions

Getting ready

How to do it...

How it works...

Executing stored procedures and functions

Getting ready

How to do it...

How it works...

Come to the Server Side

Introduction

Creating the TCP server

How to do it...

How it works...

Creating the UDP server

How to do it...

How it works...

Handling multiple clients

How to do it...

How it works...

Creating the HTTP Server

How to do it...

How it works...

Handling HTTP requests

How to do it...

How it works...

Creating HTTP middleware layer

How to do it...

How it works...

Serving static files

How to do it...

How it works...

Serving content generated with templates

How to do it...

How it works...

Handling redirects

How to do it...

How it works...

Handling cookies

How to do it...

How it works...

Gracefully shutdown the HTTP server

How to do it...

How it works...

Serving secured HTTP content

Getting ready

How to do it...

How it works...

Resolving form variables

How to do it...

How it works...

Fun with Concurrency

Introduction

Synchronizing access to a resource with Mutex

How to do it...

How it works...

Creating map for concurrent access

How to do it...

How it works...

Running a code block only once

How to do it...

How it works...

Pooling resources across multiple goroutines

How to do it...

How it works...

Synchronizing goroutines with WaitGroup

How to do it...

How it works...

Getting the fastest result from multiple sources

How to do it...

How it works...

Propagating errors with errgroup

How to do it...

How it works...

Tips and Tricks

Introduction

Logging customization

How to do it...

How it works...

Testing the code

How to do it...

How it works...

See also

Benchmarking the code

How to do it...

How it works...

See also

Creating subtests

How to do it...

How it works...

See also

Testing the HTTP handler

How to do it...

How it works...

Accessing tags via reflection

How to do it...

How it works...

Sorting slices

How to do it...

How it works...

Breaking HTTP handlers into groups

How to do it...

How it works...

Utilizing HTTP/2 server push

Getting ready

How to do it...

How it works...

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部