arcah

package module
v0.0.0-...-3f675b9 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 5 Imported by: 0

README

arcah

WIP

For now arcah api is in development and will change. Also, query engine is not yet stable and tested enough to run.

What is arcah?

Have you ever written DTOs? In golang it's tedious to write functions like ApplyMutation for each DTO, consider following example:

// Example entity
type User struct {
    Username string
    Password string // for sake of simplicity, not hashed; do not run in prod!
}

type ChangeUsernameMutation struct{
    Username string
}
func(m *ChangeUsernameMutation) Apply(u *User) (err error) {
    // any validation here or outside of apply
    u.Username = m.Username
    return
}

// Change password and maybe others there

Arcah is tool, which does:

  1. Query structures - structures, which are translated into DB queries
  2. Mutator structures - structures, which are translated into DB mutations or applied directly to entity

Arcah does not require any code, instead some metadata passed in tags is enough.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AndQuery

type AndQuery []Query

type EqQuery

type EqQuery keyValueQuery

type GtQuery

type GtQuery keyValueQuery

type GteQuery

type GteQuery keyValueQuery

type LtQuery

type LtQuery keyValueQuery

type LteQuery

type LteQuery keyValueQuery

type MongoQuery

type MongoQuery interface {
	RenderMongo() (res interface{}, err error)
}

type MongoQueryRenderer

type MongoQueryRenderer struct {
}

func (*MongoQueryRenderer) Render

func (mqr *MongoQueryRenderer) Render(query Query) (res interface{}, err error)

type NeQuery

type NeQuery keyValueQuery

type NotQuery

type NotQuery struct {
	Query
}

type OrQuery

type OrQuery []Query

type Query

type Query interface {
}

type QueryReflector

type QueryReflector struct {
	DescriptorComputer  *stdesc.Computer
	ReflectMongoQueries bool
}

func (*QueryReflector) MakeReflector

func (ref *QueryReflector) MakeReflector(val interface{}) (query Query, err error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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