db

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RoleGetId

func RoleGetId(cReg *components.Registry, ctx context.Context, name string) (string, error)

func UserDelete

func UserDelete(cReg *components.Registry, ctx context.Context, id string) error

Types

type User

type User struct {
	bun.BaseModel `bun:"users,alias:u"`
	ID            uuid.UUID `bun:"id,pk,type:uuid,default:uuid_generate_v4()" json:"id" yaml:"id"`
	Username      string    `bun:"username" json:"username" yaml:"username"`
	Password      string    `bun:"password" json:"-" yaml:"-"`
	Email         string    `bun:"email" json:"email" yaml:"email"`
	Roles         []string  `bun:",array,scanonly" json:"roles" yaml:"roles"`

	// Timestamps
	CreatedAt time.Time    `bun:"created_at,nullzero,notnull,default:current_timestamp" json:"created_at" yaml:"created_at"`
	UpdatedAt bun.NullTime `bun:"updated_at" json:"updated_at" yaml:"updated_at"`

	// SoftDelete
	DeletedAt bun.NullTime `bun:"deleted_at,soft_delete,nullzero" json:"deleted_at" yaml:"deleted_at"`
}

func UserCreate

func UserCreate(cReg *components.Registry, ctx context.Context, username, password, email string, roles []string) (*User, error)

func UserDetail

func UserDetail(cReg *components.Registry, ctx context.Context, id string) (*User, error)

func UserFindById

func UserFindById(cReg *components.Registry, ctx context.Context, id string) (*User, error)

func UserFindByUsername

func UserFindByUsername(cReg *components.Registry, ctx context.Context, username string) (*User, error)

func UserList

func UserList(cReg *components.Registry, ctx context.Context, limit, offset uint64) ([]User, error)

func UserUpdateRoles

func UserUpdateRoles(cReg *components.Registry, ctx context.Context, id string, roles []string) (*User, error)

Source Files

  • role.go
  • user.go

Jump to

Keyboard shortcuts

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