Home / File/ toml.go — gin Source File

toml.go — gin Source File

Architecture documentation for toml.go, a go file in the gin codebase. 1 imports, 0 dependents.

File go 1 imports 1 classes

Entity Profile

Dependency Diagram

graph LR
  fdc22eb3_0082_42a2_9a51_f09865d72412["toml.go"]
  08248871_dc00_f330_15ef_4a0fbf2bafbb["http"]
  fdc22eb3_0082_42a2_9a51_f09865d72412 --> 08248871_dc00_f330_15ef_4a0fbf2bafbb
  style fdc22eb3_0082_42a2_9a51_f09865d72412 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2022 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

package render

import (
	"net/http"

	"github.com/pelletier/go-toml/v2"
)

// TOML contains the given interface object.
type TOML struct {
	Data any
}

var tomlContentType = []string{"application/toml; charset=utf-8"}

// Render (TOML) marshals the given interface object and writes data with custom ContentType.
func (r TOML) Render(w http.ResponseWriter) error {
	r.WriteContentType(w)

	bytes, err := toml.Marshal(r.Data)
	if err != nil {
		return err
	}

	_, err = w.Write(bytes)
	return err
}

// WriteContentType (TOML) writes TOML ContentType for response.
func (r TOML) WriteContentType(w http.ResponseWriter) {
	writeContentType(w, tomlContentType)
}

Classes

Types

Dependencies

  • http

Frequently Asked Questions

What does toml.go do?
toml.go is a source file in the gin codebase, written in go.
What does toml.go depend on?
toml.go imports 1 module(s): http.
Where is toml.go in the architecture?
toml.go is located at render/toml.go (directory: render).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free