wip: flow task start

This commit is contained in:
loveuer
2024-04-03 16:46:25 +08:00
parent 4718532458
commit bb56271348
11 changed files with 381 additions and 155 deletions

View File

@ -0,0 +1,17 @@
package interfaces
type Enum interface {
Value() int64
Code() string
Label() string
MarshalJSON() ([]byte, error)
All() []Enum
}
type OpLogger interface {
Enum
Render(content map[string]any) (string, error)
Template() string
}

View File

@ -0,0 +1,23 @@
package interfaces
import "context"
type Input interface {
Start(context.Context, chan<- Row, chan<- error) error
Close()
}
type Pipe interface {
Start(Row) (Row, error)
Next() []Pipe
Close()
}
type Output interface {
Start(context.Context, <-chan Row, chan<- error) error
Close()
}
type Row interface {
Bytes() ([]byte, error)
}

View File

@ -0,0 +1,12 @@
package interfaces
import "github.com/loveuer/nfflow/internal/model"
type UserController interface {
GetUser(id uint64) (*model.User, error)
GetUserByToken(token string) (*model.User, error)
CacheUser(user *model.User) error
CacheToken(token string, user *model.User) error
RmUserCache(id uint64) error
DeleteUser(id uint64) error
}