Git Product home page Git Product logo

Comments (6)

brianvoe avatar brianvoe commented on September 22, 2024 1

I just reread your initial issue and if your just having issues that one struct isnt being called it sounds like it caught an issue in the previous field. Struct returns an error so you should probably look at that.

I dont think this will work ExpirationDate time.Time fake:"{year}-{month}-{day}" that might be your issue

from gofakeit.

brianvoe avatar brianvoe commented on September 22, 2024

It all comes down to how many times a function needs to run Uint64(). If you swap the order of a function that needs to run Uint64 2 times in front of a function that only needs to run it once you will alter your values.

from gofakeit.

plusiv avatar plusiv commented on September 22, 2024

@brianvoe I Apologize for my ignorance on this, but, I'm not understanding the point. Where do I use a uint64 twice? I'm just trying to realize how to use it in the right way.

from gofakeit.

brianvoe avatar brianvoe commented on September 22, 2024

It's ok took me a sec to wrap my head around it. Take a look at an example rand source below

type Dumb struct {
	state uint64
}

// NewDumb initializes a Dumb source
func NewDumb(seed uint64) *Dumb {
	d := &Dumb{}
	d.Seed(seed)
	return d
}

func (d *Dumb) Seed(seed uint64) {
	d.state = seed
}

// Uint64 returns the next number in the sequence, incrementing the state.
func (d *Dumb) Uint64() uint64 {
	d.state += 1
	return d.state
}

So every time Uint64 is run it generates a new number.

In Gofakeit some functions may need to run Uint64() multiple times. Thus if you swap fields around, then you get an alternative output cause your previous function was given a different value then the order it was in before.

from gofakeit.

plusiv avatar plusiv commented on September 22, 2024

I just reread your initial issue and if your just having issues that one struct isnt being called it sounds like it caught an issue in the previous field. Struct returns an error so you should probably look at that.

I dont think this will work ExpirationDate time.Time fake:"{year}-{month}-{day}" that might be your issue

You're right, I was specifying that tag in a wrong way. Fixing it worked!

Thank you so much.

from gofakeit.

brianvoe avatar brianvoe commented on September 22, 2024

No problem.

from gofakeit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.