entity

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Empty = ""
	Token = "token"
	Zero  = 0
)
View Source
const (
	Create  = "create"
	Update  = "update"
	Delete  = "delete"
	Get     = "get"
	GetList = "getlist"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthClaims

type AuthClaims struct {
	jwt.RegisteredClaims
}

type Config

type Config struct {
	FirstUser struct {
		Login    string `yaml:"login"`
		Password string `yaml:"password" `
	} `yaml:"first_user"`

	HTTP Server `yaml:"server_http"`

	JWT struct {
		TTL         time.Duration `yaml:"ttl"`
		TokenClaims string        `yaml:"token_claims"`
	}

	SQL struct {
		PathSQL      string        `yaml:"path_sql"`
		PathSQLName  string        `yaml:"path_sql_name"`
		Timeout      time.Duration `yaml:"timeout"`
		MaxOpenConns int           `yaml:"max_open_conns"`
		MaxIdleConns int           `yaml:"max_idle_conns"`
	}
}

type ExteranlSQL

type ExteranlSQL interface {
	Get(ctx context.Context, conditional string, values []any) (*UserDB, error)
	GetList(ctx context.Context) ([]*UserDB, error)
	Create(ctx context.Context, items map[string]any) error
	Update(ctx context.Context, items, condition map[string]any) error
	Delete(ctx context.Context, condition map[string]any) error
}

type Server

type Server struct {
	Mode    string  `yaml:"mode"`
	Host    string  `yaml:"host"`
	Port    string  `yaml:"port"`
	Timeout Timeout `yaml:"timeout"`
}

type Timeout

type Timeout struct {
	Write time.Duration `yaml:"write" default:"1m"`
	Read  time.Duration `yaml:"read" default:"1m"`
}

type User

type User struct {
	ID       int
	Login    string
	Password string
	Token    string
	Option   map[string]any
}

type UserDB

type UserDB struct {
	ID       int            `db:"id"`
	Login    string         `db:"login"`
	Password string         `db:"password"`
	Token    sql.NullString `db:"token"`
	Option   []byte         `db:"option"`
}

Jump to

Keyboard shortcuts

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