Skip to content

Commit

Permalink
Merge pull request #10 from Cleverse/docs/goref-documents
Browse files Browse the repository at this point in the history
Add Go-Reference Documents
  • Loading branch information
Planxnx authored Oct 25, 2023
2 parents f611013 + 780a3c8 commit d861f7c
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 2 deletions.
26 changes: 26 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2023 Cleverse. All rights reserved.
// Use of this source code is governed by a MIT License
// license that can be found in the LICENSE file.

/*
Package go-utilities provides a miscellaneous useful shared Go packages by [Cleverse].
# Packages
- [utils]: Minimalist pure Golang optimized generic utilities for Cleverse projects.
- [errors]: Minimalist and zero-dependency errors library with stacktrace support for Go (for wrapping and formatting an errors).
- [queue]: Minimalist and zero-dependency low-level and simple queue library for thread-safe and unlimited-size generics in-memory message queue library fo Go (async enqueue and blocking dequeue supports).
The alternative way to communicate between goroutines compared to `channel`
- [address]: High efficient and minimal utilities library that will help you to work with Ethereum addresses easier. (a [go-ethereum] helper library)
- [fixedpoint]: A [shopspring/decimal] wrapper library for fixed point arithmetic operations in Cleverse projects.
[Cleverse]: https://tip.golang.org/doc/comment#links
[go-ethereum]: https://github.com/ethereum/go-ethereum
[shopspring/decimal]: https://pkg.go.dev/github.com/shopspring/decimal
[utils]: https://pkg.go.dev/github.com/Cleverse/go-utilities/utils
[errors]: https://pkg.go.dev/github.com/Cleverse/go-utilities/errors
[queue]: https://pkg.go.dev/github.com/Cleverse/go-utilities/queue
[address]: https://pkg.go.dev/github.com/Cleverse/go-utilities/address
[fixedpoint]: https://pkg.go.dev/github.com/Cleverse/go-utilities/fixedpoint
*/
package goutilities
2 changes: 0 additions & 2 deletions go-utilities.go

This file was deleted.

43 changes: 43 additions & 0 deletions queue/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
# Examples
Basic usage:
q := New[string]()
q.Enqueue("Foo")
item, ok := q.Dequeue()
if !ok {
panic("item should be dequeued")
}
fmt.Println(item) // Output: Foo
Concurrency usage:
q := New[string]()
go func() {
for {
item, ok := q.Dequeue()
if !ok {
break
}
fmt.Println(item)
}
}()
data := []string{"Foo", "Bar", "Baz"}
for _, item := range data {
q.Enqueue(item)
}
q.Close() // close queue to stop goroutine
Queue is unlimited capacity, so you can enqueue as many as you want without blocking or dequeue required:
q := New[string]()
for i := 0; i < 1000000; i++ {
q.Enqueue("Foo")
}
*/
package queue

0 comments on commit d861f7c

Please sign in to comment.