Skip to content

Commit 6e1e4d0

Browse files
committed
docs: autoupdate
1 parent 1e5db42 commit 6e1e4d0

1 file changed

Lines changed: 80 additions & 54 deletions

File tree

README.md

Lines changed: 80 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,41 @@
1515
1616
-->
1717

18-
<h1 align="center">AtomicGo | template</h1>
18+
<h1 align="center">AtomicGo | convert</h1>
1919

2020
<p align="center">
21-
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fatomicgo.dev%2Fapi%2Fshields%2Ftemplate&style=flat-square" alt="Downloads">
21+
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fatomicgo.dev%2Fapi%2Fshields%2Fconvert&style=flat-square" alt="Downloads">
2222

23-
<a href="https://github.com/atomicgo/template/releases">
24-
<img src="https://img.shields.io/github/v/release/atomicgo/template?style=flat-square" alt="Latest Release">
23+
<a href="https://github.com/atomicgo/convert/releases">
24+
<img src="https://img.shields.io/github/v/release/atomicgo/convert?style=flat-square" alt="Latest Release">
2525
</a>
2626

27-
<a href="https://codecov.io/gh/atomicgo/template" target="_blank">
28-
<img src="https://img.shields.io/github/actions/workflow/status/atomicgo/template/go.yml?style=flat-square" alt="Tests">
27+
<a href="https://codecov.io/gh/atomicgo/convert" target="_blank">
28+
<img src="https://img.shields.io/github/actions/workflow/status/atomicgo/convert/go.yml?style=flat-square" alt="Tests">
2929
</a>
3030

31-
<a href="https://codecov.io/gh/atomicgo/template" target="_blank">
32-
<img src="https://img.shields.io/codecov/c/gh/atomicgo/template?color=magenta&logo=codecov&style=flat-square" alt="Coverage">
31+
<a href="https://codecov.io/gh/atomicgo/convert" target="_blank">
32+
<img src="https://img.shields.io/codecov/c/gh/atomicgo/convert?color=magenta&logo=codecov&style=flat-square" alt="Coverage">
3333
</a>
3434

35-
<a href="https://codecov.io/gh/atomicgo/template">
36-
<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-3-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
35+
<a href="https://codecov.io/gh/atomicgo/convert">
36+
<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-33-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
3737
</a>
3838

3939
<a href="https://opensource.org/licenses/MIT" target="_blank">
4040
<img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT">
4141
</a>
4242

43-
<a href="https://goreportcard.com/report/github.com/atomicgo/template" target="_blank">
44-
<img src="https://goreportcard.com/badge/github.com/atomicgo/template?style=flat-square" alt="Go report">
43+
<a href="https://goreportcard.com/report/github.com/atomicgo/convert" target="_blank">
44+
<img src="https://goreportcard.com/badge/github.com/atomicgo/convert?style=flat-square" alt="Go report">
4545
</a>
4646

4747
</p>
4848

4949
---
5050

5151
<p align="center">
52-
<strong><a href="https://pkg.go.dev/atomicgo.dev/template#section-documentation" target="_blank">Documentation</a></strong>
52+
<strong><a href="https://pkg.go.dev/atomicgo.dev/convert#section-documentation" target="_blank">Documentation</a></strong>
5353
|
5454
<strong><a href="https://github.com/atomicgo/atomicgo/blob/main/CONTRIBUTING.md" target="_blank">Contributing</a></strong>
5555
|
@@ -68,7 +68,7 @@
6868
</tbody>
6969
</table>
7070
</p>
71-
<h3 align="center"><pre>go get atomicgo.dev/template</pre></h3>
71+
<h3 align="center"><pre>go get atomicgo.dev/convert</pre></h3>
7272
<p align="center">
7373
<table>
7474
<tbody>
@@ -80,17 +80,13 @@
8080

8181
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
8282

83-
# template
83+
# convert
8484

8585
```go
86-
import "atomicgo.dev/template"
86+
import "atomicgo.dev/convert"
8787
```
8888

89-
Package template is used to generate new AtomicGo repositories.
90-
91-
Write the description of the module here. You can use \*\*markdown\*\*\! This description should clearly explain what the package does.
92-
93-
Example description: https://golang.org/src/encoding/gob/doc.go
89+
Package convert contains many functions for converting between different go types and units.
9490

9591

9692

@@ -99,64 +95,94 @@ Example description: https://golang.org/src/encoding/gob/doc.go
9995
```go
10096
package main
10197

102-
import (
103-
"fmt"
104-
105-
"atomicgo.dev/template"
106-
)
98+
import ()
10799

108100
func main() {
109-
fmt.Println(template.HelloWorld())
110101
}
111102
```
112103

113-
#### Output
114-
115-
```
116-
Hello, World!
117-
```
118-
119104

120105

121106
## Index
122107

123-
- [func HelloWorld\(\) string](<#HelloWorld>)
108+
- [func Length\(value float64, from, to LengthUnit\) float64](<#Length>)
109+
- [type LengthUnit](<#LengthUnit>)
124110

125111

126-
<a name="HelloWorld"></a>
127-
## func [HelloWorld](<https://github.com/atomicgo/convert/blob/main/template.go#L4>)
112+
<a name="Length"></a>
113+
## func [Length](<https://github.com/atomicgo/convert/blob/main/length.go#L60>)
128114

129115
```go
130-
func HelloWorld() string
116+
func Length(value float64, from, to LengthUnit) float64
131117
```
132118

133-
HelloWorld returns \`Hello, World\!\`.
119+
Length converts a length value from one unit to another.
134120

121+
\*\*Warning:\*\* Due to the nature of floating point arithmetic, the result may not be exact for some conversions. Do not use this package for rocket science.
135122

123+
<a name="LengthUnit"></a>
124+
## type [LengthUnit](<https://github.com/atomicgo/convert/blob/main/length.go#L3>)
136125

137126

138127

139128
```go
140-
package main
141-
142-
import (
143-
"fmt"
144-
145-
"atomicgo.dev/template"
146-
)
147-
148-
func main() {
149-
fmt.Println(template.HelloWorld())
150-
}
129+
type LengthUnit float64
151130
```
152131

153-
#### Output
132+
<a name="Nanometer"></a>
154133

134+
```go
135+
const (
136+
// Metric system
137+
Nanometer LengthUnit = 9.999999999e-10 // Nanometer to meter conversion
138+
Micrometer LengthUnit = 0.000001 // Micrometer to meter conversion
139+
Millimeter LengthUnit = 0.001 // Millimeter to meter conversion
140+
Centimeter LengthUnit = 0.01 // Centimeter to meter conversion
141+
Decimeter LengthUnit = 0.1 // Decimeter to meter conversion
142+
Meter LengthUnit = 1 // Meter is the base unit
143+
Decameter LengthUnit = 10 // Decameter to meter conversion
144+
Hectometer LengthUnit = 100 // Hectometer to meter conversion
145+
Kilometer LengthUnit = 1000 // Kilometer to meter conversion
146+
Megameter LengthUnit = 1000000 // Megameter to meter conversion
147+
Gigameter LengthUnit = 1000000000 // Gigameter to meter conversion
148+
Terameter LengthUnit = 1000000000000 // Terameter to meter conversion
149+
Petameter LengthUnit = 1000000000000000 // Petameter to meter conversion
150+
Exameter LengthUnit = 1000000000000000000 // Exameter to meter
151+
Micron LengthUnit = 0.000001 // Micron to meter conversion
152+
Picometer LengthUnit = 1e-12 // Picometer to meter conversion
153+
Femtometer LengthUnit = 9.999999999e-16 // Femtometer to meter conversion
154+
Attometer LengthUnit = 1e-18 // Attometer to meter conversion
155+
156+
// Imperial system
157+
Thou LengthUnit = 2.54e-5 // Thou (mil) to meter conversion
158+
Inch LengthUnit = 0.0254 // Inch to meter conversion
159+
Foot LengthUnit = 0.3048 // Foot to meter conversion
160+
Yard LengthUnit = 0.9144 // Yard to meter conversion
161+
Chain LengthUnit = 20.1168 // Chain to meter conversion (66 feet)
162+
Rope LengthUnit = 6.096 // Rope to meter conversion (20 feet)
163+
Furlong LengthUnit = 201.168 // Furlong to meter conversion (1/8th of a mile)
164+
Mile LengthUnit = 1609.344 // Mile to meter conversion
165+
League LengthUnit = 4828.032 // League to meter conversion (3 miles)
166+
NauticalMile LengthUnit = 1852 // Nautical Mile to meter conversion (international)
167+
168+
// Astronomical units
169+
AstronomicalUnit LengthUnit = 149597870691 // Astronomical Unit (AU) to meter conversion
170+
LightYear LengthUnit = 9460730472580044 // Light-year to meter conversion
171+
Parsec LengthUnit = 30856775812799588 // Parsec to meter conversion
172+
Megaparsec LengthUnit = 3.085677581e+22 // Megaparsec to meter
173+
Kiloparsec LengthUnit = 30856775812799586000 // Kiloparsec to meter
174+
PlanckLength LengthUnit = 1.616049999e-35 // Planck length to meter conversion
175+
176+
// Other units
177+
Angstrom LengthUnit = 9.999999999e-11 // Angstrom to meter conversion
178+
Fathom LengthUnit = 1.8288 // Fathom to meter conversion (6 feet)
179+
Rod LengthUnit = 5.0292 // Rod to meter conversion (16.5 feet)
180+
SurveyFoot LengthUnit = 0.3048006096 // Survey foot to meter conversion (used in land surveys)
181+
Pica LengthUnit = 0.0042333333 // Pica to meter conversion (commonly used in typography)
182+
Point LengthUnit = 0.0003527778 // Point to meter conversion (1/12th of a pica)
183+
Hand LengthUnit = 0.1016 // Hand to meter conversion (used in measuring the height of horses)
184+
)
155185
```
156-
Hello, World!
157-
```
158-
159-
160186

161187
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
162188

0 commit comments

Comments
 (0)