models

package
v0.0.0-...-6a94060 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	ID        string       `json:"id"`
	CreatedAt time.Time    `json:"created_at"`
	UpdatedAt time.Time    `json:"updated_at"`
	DeletedAt sql.NullTime `json:"deleted_at"`
}

Entity contains the basic fields for database entities

type Env

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

func NewEnv

func NewEnv() *Env

func (*Env) Client

func (e *Env) Client() *mongo.Client

func (*Env) Close

func (e *Env) Close(ctx context.Context) error

func (*Env) Collection

func (e *Env) Collection(database, collection string) *mongo.Collection

func (*Env) Context

func (e *Env) Context() context.Context

func (*Env) Database

func (e *Env) Database(name string) *mongo.Database

func (*Env) Open

func (e *Env) Open(ctx context.Context, connectionString string) error

func (*Env) Ping

func (e *Env) Ping() error

Ping is used to test the connection to the MongoDB server.

type User

type User struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
}

func NewUser

func NewUser() *User

func (*User) Slug

func (u *User) Slug() string

func (*User) String

func (u *User) String() string

type UserEntity

type UserEntity struct {
	Entity
	User
}

UserEntity is the user entity for the database

Jump to

Keyboard shortcuts

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