db

package
v0.0.3 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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Setting

type Setting struct {
	bun.BaseModel `bun:"settings,alias:s"`
	ID            uuid.UUID       `bun:"id,pk,type:uuid,default:uuid_generate_v4()" json:"id" yaml:"id"`
	OwnerID       uuid.UUID       `bun:"owner_id,type:uuid" json:"owner_id" yaml:"owner_id"`
	Service       string          `json:"service" yaml:"service"`
	Name          string          `json:"name" yaml:"name"`
	Content       json.RawMessage `bun:"type:jsonb" json:"content" yaml:"content"`
	RolesRead     []string        `bun:"roles_read,array" json:"roles_read" yaml:"roles_read"`
	RolesUpdate   []string        `bun:"roles_update,array" json:"roles_update" yaml:"roles_update"`

	// Timestampable
	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 SettingsCreate

func SettingsCreate(cReg *components.Registry, ctx context.Context, in *settingspb.CreateRequest) (*Setting, error)

func SettingsGet

func SettingsGet(cReg *components.Registry, ctx context.Context, id, ownerID, service, name string) (*Setting, error)

func SettingsList

func SettingsList(cReg *components.Registry, ctx context.Context, id, ownerID, service, name string, limit, offset uint64) ([]Setting, error)

func SettingsUpdate

func SettingsUpdate(cReg *components.Registry, ctx context.Context, id, ownerID, service, name string, content json.RawMessage) (*Setting, error)

func SettingsUpsert

func SettingsUpsert(cReg *components.Registry, ctx context.Context, in *settingspb.UpsertRequest) (*Setting, error)

func (*Setting) UserHasReadPermission

func (s *Setting) UserHasReadPermission(cReg *components.Registry, ctx context.Context) bool

func (*Setting) UserHasUpdatePermission

func (s *Setting) UserHasUpdatePermission(cReg *components.Registry, ctx context.Context) bool

Jump to

Keyboard shortcuts

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