ffmt 友好的 Golang 数据格式化 ffmt

xuanbao2018-02-18 09:30:00 • 2145 次点击    
这是一个分享于 2018-02-18 09:30:00 的项目,其中的信息可能已经有所发展或是发生改变。

安装

go get -u -v gopkg.in/ffmt.v1

用法

API 文档

示例

package main

import (
    ffmt "gopkg.in/ffmt.v1"
)

func main() {
    example()
}

func example() {
    m := map[string]interface{}{
        "hello": "w",
        "A": []int{
            1, 2, 3, 4, 5, 6,
        },
    }

    ffmt.Puts(m)
    /*
       {
        "A": [
         1 2 3
         4 5 6
        ]
        "hello": "w"
       }
    */

    ffmt.P(m)
    /*
       map{
        string(A): slice[
         int(1) int(2) int(3)
         int(4) int(5) int(6)
        ]
        string(hello): string(w)
       }
    */

    ffmt.Pjson(m)
    /*
       {
        "A": [
         1,2,3
        ,4,5,6
        ]
       ,"hello": "w"
       }
    */

    m0 := ffmt.ToTable(m, m)
    ffmt.Puts(m0)
    /*
       [
        [
         "A"
         "hello"
        ]
        [
         "[1 2 3 4 5 6]"
         "w"
        ]
       ]
    */

    m1 := ffmt.FmtTable(m0)
    ffmt.Puts(m1)
    /*
       [
        "A             hello "
        "[1 2 3 4 5 6] w     "
       ]
    */

    ffmt.Mark("hello")
    /*
       main.go:76  hello
    */
}

Golang beautify data display for HumansRead More

Latest commit to the master branch on 11-19-2021
Download as zip
授权协议:
MIT
开发语言:
Google Go 查看源码»
操作系统:
跨平台
2145 次点击  
加入收藏 微博
2 回复  |  直到
ddatsh
ddatsh · #1 · 7年之前

404

polaris
polaris · #2 · 7年之前
ddatshddatsh #1 回复

404

已修复

添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传