New public repository on Github - GOModels

I have created a new repository on Github NlaakStudios/GoModels. I am still a novice with GO. Loving it, but just do not have the advanced skills to pull this off properly without support. So if you would like to come on board as a contributor and help or maybe add some of your Models to the growing list we welcome you.

The overall purpose is to stop reinventing the wheel and provide ready to go models that can be used in go applications that have support for dGraph, Badger, JSON, FileSystem and Viewing ready to go right out of the box.

If interested you can check out the project on Github or contact me though Nlaak Studios on Telegram. The project is under MIT license and is specifically for the GO Community of developers.

Hi, Andrew, why do all of the types have “Struct” at the end of their names (e.g. AddressStruct, CoinStruct, etc.) instead of just being Address, Coin, etc.? I looked at AddressStruct in particular and I’m a little confused about how it’s supposed to work: the fields are all private ans there are no functions for it, so I’m not sure how to use it.

You also mentioned not reinventing the wheel, but it looks like you defined a DateStruct that you use as a Person’s date of birth instead of using a time.Time.

I don’t mean to nit-pick, but I don’t yet understand the use case.

No, you’re not nitpicking. Looking for advice and collaboration.

So first why do they all have “struct” at the end? If you look at it my updates from last night you’ll see that the structs have the actual fields. They are raw data no interfaces. So for AddressStruct is the fields. Address by itself includes the AddressStruct as well as all interfaces.

I am doing it this way because if you don’t want to have say the Badger and File Interfaces, You can build your own Address. I am using building blocks.

Here take a look at this snippet:

// UserAuthStruct Contains user core account data for authentication
type UserAuthStruct struct {
	//Username is a unique public name for this user
	Username string
	//Email is the email for user
	Email email.EmailStruct
	//Password for user
	Password string /* hash */
	//Remember keeps user logged in
	Remember bool
	//Status tracks Authentication status. See consts UserStatus???
	Status uint
	//Created is the when the account was created
	Created time.Time
	//LastAuth is the last time the user authenticated
	LastAuth time.Time
	//LastSeen is the last time the action was detected by user
	LastSeen time.Time
	//Devices is whitelist of device ID's
	Devices []string
	//IPAddrs is whitelist of IP Addresses
	IPAddrs []string

//UserAuthInterface enforce defining core methods
type UserAuthInterface interface {

//UserAuth Complete UserAuth - Structure and Interfaces
type UserAuth struct {

Obviously I’m making it up as I go and planning as I go.

Take a look at UserAuth.go You will get an idea of where I am headed.

As to the DateStruct… I’m still learning GO and might have missed that. But basically, I wanted Date to be able to be a node by itself so you could maybe find everybody with the same year or month or maybe year and
month if you’re going to have a sale something like that. Just trying to be flexible but simple.

Nothing set in stone. I wouldn’t even call it Alpha version yet. There is a long way to go and alot to learn still :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.