rename
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
package lobby
|
||||
|
||||
import "context"
|
||||
|
||||
type Lobby interface{}
|
||||
|
||||
type lobby struct{}
|
||||
|
||||
func NewLobby(ctx context.Context) (Lobby, error) {
|
||||
return lobby{}, nil
|
||||
}
|
||||
41
src/state/fsm/lobby/lobby.go
Normal file
41
src/state/fsm/lobby/lobby.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package lobby
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitea/price-is-wrong/src/lib"
|
||||
"io"
|
||||
)
|
||||
|
||||
type Lobby struct{}
|
||||
|
||||
func Open(ctx context.Context, id string) (Lobby, error) {
|
||||
result, err := open(ctx, id)
|
||||
if err != nil {
|
||||
return Lobby{}, err
|
||||
}
|
||||
if result != nil {
|
||||
} else if err := create(ctx, id); err != nil {
|
||||
return Lobby{}, err
|
||||
} else if result, err = open(ctx, id); err != nil {
|
||||
return Lobby{}, err
|
||||
} else if result != nil {
|
||||
} else {
|
||||
return Lobby{}, fmt.Errorf("unable to create new lobby %s", id)
|
||||
}
|
||||
return *result, err
|
||||
}
|
||||
|
||||
func open(ctx context.Context, id string) (*Lobby, error) {
|
||||
return nil, io.EOF
|
||||
}
|
||||
|
||||
func create(ctx context.Context, id string) error {
|
||||
return io.EOF
|
||||
}
|
||||
|
||||
func init(ctx context.Context) error {
|
||||
_, err := lib.ExtractDB(ctx).ExecContext(ctx, `
|
||||
`)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user