Lufuhu Technical Blog

website·Indexed 30 days ago

https://www.lufuhu.com

A collection of technical guides and documentation covering Go (Golang), Docker, K3s, Nginx, and Vue.js. Includes specific tutorials on tools like Excelize, Wails, Ent, and Harbor, as well as references for HTTP status codes, network configuration, and deployment strategies.

Tokens
39K
Snippets
249
Records
297
Agent score
50%

What's inside Lufuhu

  1. Overview of Excelize for Go

    Excelize is a Go library used to read and write Office Excel documents created with Microsoft Excel 2007 and above. It supports multiple formats including XLAM, XLSM, XLSX, XLTM, and XLTX. It is compatible with complex components such as styles, images, pivot tables, and slicers, and provides streaming read/write functions for large datasets.

    Requirement: Go version 1.24.0 or higher.

  2. Overview of Wails for Go Desktop Applications

    Wails is a framework that enables developers to build desktop applications by packaging Go code and a web frontend into a single binary. Unlike traditional methods that use a built-in web server, Wails provides a native rendering engine (without embedding a full browser) to create cross-platform applications. Key capabilities include:

    • Backend development using standard Go.
    • Frontend development using any familiar web technology.
    • Ability to call Go methods directly from JavaScript.
    • Automatic TypeScript declaration generation for Go structs and methods.
    • Support for native dialogs, menus, and modern UI effects like translucency and 'frosted glass'.
    • A unified event system for communication between Go and JavaScript.
    • A powerful CLI for project generation and building.
  3. Overview of Ent Entity Framework

    Ent is an entity framework for Go that treats the graph as code, allowing developers to model database tables as Go objects. Key features include:

    • Static typing and explicit APIs generated via code generation.
    • Ability to run queries, aggregations, and traversals across graph structures.
    • Support for multiple storage drivers: MySQL, PostgreSQL, SQLite, and Gremlin.
    • Extensibility through Go templates.
  4. Overview of overseer for Go binaries

    overseer is a Go package designed to create binaries that support monitoring, graceful zero-down time restarts, and self-upgrading. It acts as a wrapper: a main process manages upgrades and signal proxying, while a child process runs the actual application logic. This architecture ensures that graceful restarts (passing listening sockets between processes) do not trigger false crash detections in process managers like systemd, upstart, or supervisor.
  5. Implement multi-platform binary fetching

    Use the runtime package to dynamically construct the fetch URL based on the operating system and architecture of the running binary.
    func main() {
    	overseer.Run(overseer.Config{
    		Program: prog,
    		Fetcher: &fetcher.HTTP{
    			URL: "http://localhost:4000/binaries/app-"+runtime.GOOS+"- "+runtime.GOARCH,
    		},
    	})
    }
  6. Use overseer for binary service management in Go

    overseer is a Go package used to create binaries that support monitoring, graceful restarts, and self-upgrading capabilities.
  7. Reference common HTTP response headers

    HTTP response headers are sent by the server to the client to provide metadata about the response, the server, and caching policies. Key response headers include:

    • Content-Type: Specifies the MIME type of the returned content (e.g., text/html; charset=utf-8).
    • Content-Length: The length of the response body in bytes.
    • Cache-Control: Directs caching mechanisms whether the response can be cached and how (e.g., no-cache).
    • Location: Used for redirection to a different URL.
    • Set-Cookie: Used by the server to send a cookie to the client.
    • ETag: An entity tag used for cache validation and conditional requests.
    • Last-Modified: The date and time the requested resource was last changed.
    • Server: Information about the web server software used.
    • WWW-Authenticate: Defines the authentication scheme the client must use to access the resource.
    Content-Type: text/html; charset=utf-8
    Content-Length: 348
    Cache-Control: no-cache
    Location: https://www.lufuhu.com/
    Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1
    ETag: "737060cd8c284d8af7ad3082f209582d"
    Last-Modified: Tue, 15 Nov 2023 12:45:26 GMT
    Server: Apache/1.3.27 (Unix) (Red-Hat/Linux)
    WWW-Authenticate: Basic
  8. Understand HTTP header categories

    HTTP headers are divided into four main categories. Each header field consists of a name, a colon (:), and a value.

    • General Headers: Can be used in both requests and responses; they relate to the overall transaction rather than a specific resource.
    • Request Headers: Allow the client to pass information about itself and the desired format of the response.
    • Response Headers: Used by the server to pass information about the response.
    • Entity Headers: Define information about the resource being transmitted; these can be used in both requests and responses.
  9. Reference common HTTP request headers

    HTTP request headers allow clients to specify preferences, authentication, and metadata about the request. Common headers include:

    • Content Negotiation: Accept (content type), Accept-Charset (character encoding), Accept-Encoding (compression types), Accept-Language (language).
    • Authentication & Identity: Authorization (credentials), Proxy-Authorization (proxy credentials), User-Agent (client software info), From (user email).
    • Caching & Conditional Requests: Cache-Control (caching mechanism), If-Modified-Since (request if modified after date), If-None-Match (request if Etag differs), If-Match (request if Etag matches), If-Unmodified-Since (request if not modified since date), If-Range (request partial content if Etag matches).
    • Connection & Routing: Host (server domain/port), Connection (persistence), Upgrade (protocol switch), Via (proxy/gateway info), Referer (source URL).
    • Entity & Range Control: Content-Length (body size), Content-Type (MIME type), Range (request specific byte range), Accept-Ranges (capability to request sub-ranges).
    • Other: Cookie (stored cookies for the domain), Date (request timestamp), Expect (expected server behavior), Max-Forwards (proxy hop limit), Pragma (implementation-specific directives), TE (transfer encoding preferences), Warning (entity warnings).
    GET /index.html HTTP/1.1
    Host: www.lufuhu.com
    User-Agent: Mozilla/5.0 (Linux; X11)
    Accept: text/html
    Accept-Language: en,zh
    Connection: close
  10. Manipulate Excel documents with Excelize

    Excelize is a foundational library written in Go specifically for operating on Office Excel documents.
  11. Use ent for entity framework in Go

    ent is a powerful entity framework for the Go programming language used to manage data models and entities.