Popularity
2.3
Declining
Activity
3.8
Declining
34
2
3
Programming language: Go
License: MIT License
Tags:
Utilities
Latest version: v1.0.2
tome alternatives and similar packages
Based on the "Utilities" category.
Alternatively, view tome alternatives based on common mentions on social networks and blogs.
-
项目文档
基于vite+vue3+gin搭建的开发基础平台(支持TS,JS混用),集成jwt鉴权,权限管理,动态路由,显隐可控组件,分页封装,多点登录拦截,资源权限,上传下载,代码生成器,表单生成器等开发必备功能。 -
excelize
Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets -
xlsx
(No longer maintained!) Go (golang) library for reading and writing XLSX files. -
godotenv
A Go port of Ruby's dotenv library (Loads environment variables from .env files) -
go-funk
A modern Go utility library which provides helpers (map, find, contains, filter, ...) -
gorequest
GoRequest -- Simplified HTTP client ( inspired by nodejs SuperAgent ) -
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report. -
Kopia
Cross-platform backup tool for Windows, macOS & Linux with fast, incremental backups, client-side end-to-end encryption, compression and data deduplication. CLI and GUI included. -
gojson
Automatically generate Go (golang) struct definitions from example JSON -
create-go-app
✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command! -
spinner
Go (golang) package with 90 configurable terminal spinner/progress indicators. -
filetype
Fast, dependency-free Go package to infer binary file types based on the magic numbers header signature -
mole
CLI application to create ssh tunnels focused on resiliency and user experience. -
boilr
:zap: boilerplate template manager that generates files or directories from template repositories -
EaseProbe
A simple, standalone, and lightweight tool that can do health/status checking, written in Go. -
beaver
💨 A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps. -
go-underscore
Helpfully Functional Go - A useful collection of Go utilities. Designed for programmer happiness. -
mimetype
A fast Golang library for media type and file extension detection, based on magic numbers -
JobRunner
Framework for performing work asynchronously, outside of the request flow
Access the most powerful time series database as a service
Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.
Promo
www.influxdata.com
Do you think we are missing an alternative of tome or a related project?
Popular Comparisons
README
Package tome was designed to paginate simple RESTful APIs.
Installation
go get -u github.com/cyruzin/tome
Usage
To get started, import the tome
package and initiate the pagination:
import "github.com/cyruzin/tome"
// Post type is a struct for a single post.
type Post struct {
Title string `json:"title"`
Body string `json:"body"`
}
// Posts type is a struct for multiple posts.
type Posts []*Post
// Result type is a struct of posts with pagination.
type Result struct {
Data *Posts `json:"data"`
*tome.Chapter
}
// GetPosts gets the latest 10 posts with pagination.
func GetPosts(w http.ResponseWriter, r *http.Request) {
// Creating a tome chapter with links.
chapter := &tome.Chapter{
// Setting base URL.
BaseURL: "http://yourapi.com/v1/posts",
// Enabling link results.
Links: true,
// Page that you captured in params inside you handler.
NewPage: 2,
// Total of pages, this usually comes from a SQL query total rows result.
TotalResults: model.GetPostsTotalResults(),
}
// Paginating the results.
if err := chapter.Paginate(); err != nil {
w.WriteHeader(http.StatusUnprocessableEntity) // Setting status 422.
json.NewEncoder(w).Encode(err) // Returning JSON with an error.
return
}
// Here you pass the offset and limit.
database, err := model.GetPosts(chapter.Offset, chapter.Limit)
if err != nil {
w.WriteHeader(http.StatusUnprocessableEntity) // Setting status 422.
json.NewEncoder(w).Encode(err) // Returning JSON with an error.
return
}
// Mocking results with pagination.
res := &Result{Data: database, Chapter: chapter}
w.WriteHeader(http.StatusOK) // Setting status 200.
json.NewEncoder(w).Encode(res) // Returning success JSON.
}
Output:
{
"data": [
{
"title": "What is Lorem Ipsum?",
"body": "Lorem Ipsum is simply dummy text of the printing and..."
},
{
"title": "Why do we use it?",
"body": "It is a long established fact that a reader will be..."
}
],
"base_url": "http://yourapi.com/v1/posts",
"next_url": "http://yourapi.com/v1/posts?page=3",
"prev_url": "http://yourapi.com/v1/posts?page=1",
"per_page": 10,
"current_page": 2,
"last_page": 30,
"total_results": 300
}
Performance
Without links:
Iterations | ns/op | B/op | allocs/op |
---|---|---|---|
200000000 | 7.80 | 0 | 0 |
With links:
Iterations | ns/op | B/op | allocs/op |
---|---|---|---|
10000000 | 133 | 96 | 2 |
*Note that all licence references and agreements mentioned in the tome README section above
are relevant to that project's source code only.