Co-authored-by: matst80 <mats.tornberg@gmail.com> Reviewed-on: #8 Co-authored-by: Mats Törnberg <mats@tornberg.me> Co-committed-by: Mats Törnberg <mats@tornberg.me>
16 lines
266 B
Go
16 lines
266 B
Go
package cart
|
|
|
|
import (
|
|
"errors"
|
|
|
|
messages "git.k6n.net/go-cart-actor/proto/cart"
|
|
)
|
|
|
|
func SetUserId(grain *CartGrain, req *messages.SetUserId) error {
|
|
if req.UserId == "" {
|
|
return errors.New("user ID cannot be empty")
|
|
}
|
|
grain.userId = req.UserId
|
|
return nil
|
|
}
|