gimei

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const DomainExample = "example.com"

DomainExample is "example.com" domain name.

Variables

View Source
var Females = Names{}/* 10702 elements not displayed */
View Source
var LastNames = Names{}/* 500 elements not displayed */
View Source
var Males = Names{}/* 2537 elements not displayed */

Functions

This section is empty.

Types

type Gender

type Gender int

Gender is enumeration of gender

const (
	Male Gender = iota
	Female
	Other
)

func (Gender) String

func (g Gender) String() string

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator is context for gimei generator.

func New

func New() *Generator

New function returns Generator instance.

Example
package main

import (
	"fmt"

	"github.com/goark/gimei-cli/gimei"
	"github.com/goark/mt/mt19937"
)

func main() {
	gen := gimei.New().WithRandSource(mt19937.New(19650218)).WithGenderOther(true).WithUnique(true)
	for i := 0; i < 15; i++ {
		fmt.Println(gen.New())
	}
}
Output:

宮原 比呂志 (ミヤハラ ヒロシ : 男性)
小島 麗夏 (コジマ レイナ : 女性)
中川 温彦 (ナカガワ アツヒコ : 男性)
渋谷 範久 (シブヤ ノリヒサ : 男性)
奥村 櫂斗 (オクムラ カイト : 男性)
田島 由惠 (タジマ ヨシエ : 女性)
寺田 歩武 (テラダ アユム : 男性)
上野 謙一 (ウエノ ケンイチ : 男性)
村瀬 殊莉 (ムラセ コトリ : 女性)
荒川 望叶 (アラカワ ミカ : 女性)
福永 美妙 (フクナガ ミサ : 女性)
下村 智浩 (シモムラ トモヒロ : 男性)
小谷 水希 (コタニ ミキ : その他)
今井 氷魚 (イマイ ヒオ : 男性)
桑原 草太 (クワハラ ソウタ : その他)

func (*Generator) New

func (gen *Generator) New() *Gimei

New method return new Gimei instance.

func (*Generator) WithGenderOther

func (gen *Generator) WithGenderOther(flag bool) *Generator

WithGenderOther methos sets other flag.

func (*Generator) WithRandSource

func (gen *Generator) WithRandSource(src rand.Source) *Generator

WithRandSource method sets rand.Source.

func (*Generator) WithUnique

func (gen *Generator) WithUnique(flag bool) *Generator

WithUnique method sets unique flag.

type Gimei

type Gimei struct {
	Gender    Gender
	FirstName *name.Name
	LastName  *name.Name
}

Gimei is pseudo personal name (gimei) information.

func NewGimei

func NewGimei(rand rand.Source, g Gender) *Gimei

NewGimei function returns new Gimei instance.

Example
package main

import (
	"fmt"

	"github.com/goark/gimei-cli/gimei"
	"github.com/goark/mt/mt19937"
	"golang.org/x/text/cases"
	"golang.org/x/text/language"
)

func main() {
	fmt.Println(gimei.NewGimei(mt19937.New(19650218), gimei.Male))
	fg := gimei.NewGimei(mt19937.New(19650218), gimei.Female)
	fmt.Println(fg.FullName().Name)
	fmt.Println(fg.FullName().Katakana)
	fmt.Println(fg.FullName().Hiragana)
	fmt.Println(cases.Title(language.Und, cases.NoLower).String(fg.FullName().Roman))
	fmt.Println(fg.Email())
}
Output:

菊池 貴志 (キクチ タカシ : 男性)
菊池友美
キクチトモミ
きくちともみ
Kikuchi Tomomi
t.kikuchi@example.com

func (*Gimei) Email

func (g *Gimei) Email() string

Email method returns email address.

func (*Gimei) EmailWithDomain

func (g *Gimei) EmailWithDomain(domain string) string

EmailWithDomain method returns email address with the domain name.

func (*Gimei) FullName

func (g *Gimei) FullName() *name.Name

FullName method returns full name of gimei.

func (*Gimei) FullNameWithSep

func (g *Gimei) FullNameWithSep(sep string) *name.Name

FullNameWithSep method returns full name of gimei with the separator.

func (*Gimei) String

func (g *Gimei) String() string

type Names

type Names []*name.Name

Names is list of names

Jump to

Keyboard shortcuts

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