Help us shape the future of Go! Take the 2026 Go Developer Survey

akashi

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Example
package main

import (
	"fmt"
	"time"

	"github.com/seiyab/akashi"
)

type User struct {
	ID           string
	Name         string
	RegisteredAt time.Time
}

func main() {
	s := akashi.DiffString(
		User{
			ID:           "123",
			Name:         "Alice",
			RegisteredAt: time.Date(2025, 2, 3, 23, 3, 15, 0, time.UTC),
		},
		User{
			ID:           "123",
			Name:         "Alice",
			RegisteredAt: time.Date(2024, 12, 19, 5, 45, 50, 0, jst),
		},
	)

	fmt.Println(s)

}
Output:
  akashi_test.User{
    ID: "123",
    Name: "Alice",
-   RegisteredAt: time.Time("2025-02-03 23:03:15 +0000 UTC"),
+   RegisteredAt: time.Time("2024-12-19 05:45:50 +0900 JST"),
  }
Example (Slice)
package main

import (
	"fmt"

	"github.com/seiyab/akashi"
)

func main() {
	s := akashi.DiffString(
		[]string{"a", "b", "c", "d"},
		[]string{"a", "c", "d", "e"},
	)

	fmt.Println(s)

}
Output:
  []string{
    "a",
-   "b",
    "c",
    "d",
+   "e",
  }

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffString

func DiffString(x, y interface{}, options ...Option) string

DiffString returns a string that represents the difference between x and y.

Types

type Option

type Option func(*differ) *differ

Option is an option for DiffString.

func WithFormat

func WithFormat(fn interface{}) Option

WithFormat sets a function to format a value.

func WithReflectEqual

func WithReflectEqual(fn func(v1, v2 reflect.Value) bool) Option

WithReflectEqual sets a function to compare reflect.Value.

Directories

Path Synopsis
internal
doc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL