event

package
v0.0.8-beta Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package event is a generated GoMock package.

Index

Constants

View Source
const ServiceName = "event"

Variables

View Source
var (
	ErrEventDoesNotExist    = errors.New("event does not exist")
	ErrWorkshopDoesNotExist = errors.New("workshop does not exist")
	ErrRetrieveWorkshopList = errors.New("retrieving workshop list failed")
)
View Source
var (
	GitCommit string
	Version   string
)

Build Variables picked up by govvv go get github.com/ahmetb/govvv

View Source
var (
	ErrUnauthorized = errors.New("role insufficient to act on desired instances")
)
View Source
var EventService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "EventService",
	HandlerType: (*EventServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetWorkshops",
			Handler:    _EventService_GetWorkshops_Handler,
		},
		{
			MethodName: "CreateWorkshop",
			Handler:    _EventService_CreateWorkshop_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/event.proto",
}

EventService_ServiceDesc is the grpc.ServiceDesc for EventService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_proto_event_proto protoreflect.FileDescriptor

Functions

func RegisterEventServiceServer

func RegisterEventServiceServer(s grpc.ServiceRegistrar, srv EventServiceServer)

Types

type DBAPI

type DBAPI interface {
	BeginTx(ctx context.Context) (*sql.Tx, error)
	Commit(tx *sql.Tx) error
	Rollback(tx *sql.Tx) error
	CreateWorkshop(ctx context.Context, data *Workshop) (workshop *m.Workshop, err error)
	ListWorkshops(ctx context.Context, instanceID string, page paging.Page) (list WorkshopList, err error)
	GetWorkshop(ctx context.Context, workshopID string) (workshop *m.Workshop, err error)
	DeleteWorkshop(ctx context.Context, workshopID string) (err error)
	CreateEvent(ctx context.Context, data *Event) (event *m.Event, err error)
	GetEvent(ctx context.Context, eventID string) (event *m.Event, err error)
}

type Env

type Env struct {
	service.DBEnv
	tokens.TokenEnv
	service.HTTPEnv
	AllowOrigins []string
	// contains filtered or unexported fields
}

Env is a hierarchical environment configuration for the authentication service and it's API handlers.

func Load

func Load() (env Env, err error)

func (Env) Setup

func (env Env) Setup() (s Service, err error)

type Event

type Event struct {
	Id        string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Instance  *auth.Instance         `protobuf:"bytes,2,opt,name=instance,proto3" json:"instance,omitempty"`
	EventInfo *Event_Info            `protobuf:"bytes,3,opt,name=eventInfo,proto3" json:"eventInfo,omitempty"`
	Starts    *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=starts,proto3" json:"starts,omitempty"`
	Ends      *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=ends,proto3" json:"ends,omitempty"`
	Workshps  []*Workshop            `protobuf:"bytes,6,rep,name=workshps,proto3" json:"workshps,omitempty"`
	// contains filtered or unexported fields
}

func (*Event) Descriptor deprecated

func (*Event) Descriptor() ([]byte, []int)

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetEnds

func (x *Event) GetEnds() *timestamppb.Timestamp

func (*Event) GetEventInfo

func (x *Event) GetEventInfo() *Event_Info

func (*Event) GetId

func (x *Event) GetId() string

func (*Event) GetInstance

func (x *Event) GetInstance() *auth.Instance

func (*Event) GetStarts

func (x *Event) GetStarts() *timestamppb.Timestamp

func (*Event) GetWorkshps

func (x *Event) GetWorkshps() []*Workshop

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

type EventServiceClient

type EventServiceClient interface {
	GetWorkshops(ctx context.Context, in *paging.Paging, opts ...grpc.CallOption) (*WorkshopList, error)
	CreateWorkshop(ctx context.Context, in *Workshop, opts ...grpc.CallOption) (*Workshop, error)
}

EventServiceClient is the client API for EventService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type EventServiceServer

type EventServiceServer interface {
	GetWorkshops(context.Context, *paging.Paging) (*WorkshopList, error)
	CreateWorkshop(context.Context, *Workshop) (*Workshop, error)
	// contains filtered or unexported methods
}

EventServiceServer is the server API for EventService service. All implementations must embed UnimplementedEventServiceServer for forward compatibility

type Event_Info

type Event_Info struct {
	Title        string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Slug         string `protobuf:"bytes,2,opt,name=slug,proto3" json:"slug,omitempty"`
	LocationName string `protobuf:"bytes,3,opt,name=locationName,proto3" json:"locationName,omitempty"`
	LocationURL  string `protobuf:"bytes,4,opt,name=locationURL,proto3" json:"locationURL,omitempty"`
	// contains filtered or unexported fields
}

func (*Event_Info) Descriptor deprecated

func (*Event_Info) Descriptor() ([]byte, []int)

Deprecated: Use Event_Info.ProtoReflect.Descriptor instead.

func (*Event_Info) GetLocationName

func (x *Event_Info) GetLocationName() string

func (*Event_Info) GetLocationURL

func (x *Event_Info) GetLocationURL() string

func (*Event_Info) GetSlug

func (x *Event_Info) GetSlug() string

func (*Event_Info) GetTitle

func (x *Event_Info) GetTitle() string

func (*Event_Info) ProtoMessage

func (*Event_Info) ProtoMessage()

func (*Event_Info) ProtoReflect

func (x *Event_Info) ProtoReflect() protoreflect.Message

func (*Event_Info) Reset

func (x *Event_Info) Reset()

func (*Event_Info) String

func (x *Event_Info) String() string

type MockDBAPI

type MockDBAPI struct {
	// contains filtered or unexported fields
}

MockDBAPI is a mock of DBAPI interface.

func NewMockDBAPI

func NewMockDBAPI(ctrl *gomock.Controller) *MockDBAPI

NewMockDBAPI creates a new mock instance.

func (*MockDBAPI) BeginTx

func (m *MockDBAPI) BeginTx(arg0 context.Context) (*sql.Tx, error)

BeginTx mocks base method.

func (*MockDBAPI) Commit

func (m *MockDBAPI) Commit(arg0 *sql.Tx) error

Commit mocks base method.

func (*MockDBAPI) CreateEvent

func (m *MockDBAPI) CreateEvent(arg0 context.Context, arg1 *Event) (*dbmodels.Event, error)

CreateEvent mocks base method.

func (*MockDBAPI) CreateWorkshop

func (m *MockDBAPI) CreateWorkshop(arg0 context.Context, arg1 *Workshop) (*dbmodels.Workshop, error)

CreateWorkshop mocks base method.

func (*MockDBAPI) DeleteWorkshop

func (m *MockDBAPI) DeleteWorkshop(arg0 context.Context, arg1 string) error

DeleteWorkshop mocks base method.

func (*MockDBAPI) EXPECT

func (m *MockDBAPI) EXPECT() *MockDBAPIMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockDBAPI) GetEvent

func (m *MockDBAPI) GetEvent(arg0 context.Context, arg1 string) (*dbmodels.Event, error)

GetEvent mocks base method.

func (*MockDBAPI) GetWorkshop

func (m *MockDBAPI) GetWorkshop(arg0 context.Context, arg1 string) (*dbmodels.Workshop, error)

GetWorkshop mocks base method.

func (*MockDBAPI) ListWorkshops

func (m *MockDBAPI) ListWorkshops(arg0 context.Context, arg1 string, arg2 paging.Page) (WorkshopList, error)

ListWorkshops mocks base method.

func (*MockDBAPI) Rollback

func (m *MockDBAPI) Rollback(arg0 *sql.Tx) error

Rollback mocks base method.

type MockDBAPIMockRecorder

type MockDBAPIMockRecorder struct {
	// contains filtered or unexported fields
}

MockDBAPIMockRecorder is the mock recorder for MockDBAPI.

func (*MockDBAPIMockRecorder) BeginTx

func (mr *MockDBAPIMockRecorder) BeginTx(arg0 interface{}) *gomock.Call

BeginTx indicates an expected call of BeginTx.

func (*MockDBAPIMockRecorder) Commit

func (mr *MockDBAPIMockRecorder) Commit(arg0 interface{}) *gomock.Call

Commit indicates an expected call of Commit.

func (*MockDBAPIMockRecorder) CreateEvent

func (mr *MockDBAPIMockRecorder) CreateEvent(arg0, arg1 interface{}) *gomock.Call

CreateEvent indicates an expected call of CreateEvent.

func (*MockDBAPIMockRecorder) CreateWorkshop

func (mr *MockDBAPIMockRecorder) CreateWorkshop(arg0, arg1 interface{}) *gomock.Call

CreateWorkshop indicates an expected call of CreateWorkshop.

func (*MockDBAPIMockRecorder) DeleteWorkshop

func (mr *MockDBAPIMockRecorder) DeleteWorkshop(arg0, arg1 interface{}) *gomock.Call

DeleteWorkshop indicates an expected call of DeleteWorkshop.

func (*MockDBAPIMockRecorder) GetEvent

func (mr *MockDBAPIMockRecorder) GetEvent(arg0, arg1 interface{}) *gomock.Call

GetEvent indicates an expected call of GetEvent.

func (*MockDBAPIMockRecorder) GetWorkshop

func (mr *MockDBAPIMockRecorder) GetWorkshop(arg0, arg1 interface{}) *gomock.Call

GetWorkshop indicates an expected call of GetWorkshop.

func (*MockDBAPIMockRecorder) ListWorkshops

func (mr *MockDBAPIMockRecorder) ListWorkshops(arg0, arg1, arg2 interface{}) *gomock.Call

ListWorkshops indicates an expected call of ListWorkshops.

func (*MockDBAPIMockRecorder) Rollback

func (mr *MockDBAPIMockRecorder) Rollback(arg0 interface{}) *gomock.Call

Rollback indicates an expected call of Rollback.

type Service

type Service struct {
	Env
	service.DBConn
	DBAPI DBAPI
	service.HTTPServer
	TokenAPI     *tokens.TokenController
	AllowOrigins map[string]struct{}
}

Service offers the APIs of the event service. This struct holds hierarchically structured state that is shared between requests.

func Main

func Main() (s Service, err error)

func (*Service) AddInfoHandlers

func (s *Service) AddInfoHandlers(routerGroup *gin.RouterGroup)

AddInfoHandlers adds new handlers to retrieve model structure info.

func (*Service) CreateWorkshop

func (s *Service) CreateWorkshop(ctx *gin.Context) (workshop *m.Workshop, err error)

func (*Service) CreateWorkshopHandler

func (s *Service) CreateWorkshopHandler() gin.HandlerFunc

CreateWorkshopHandler creates a new workshop.

func (*Service) DeleteWorkshop

func (s *Service) DeleteWorkshop(ctx *gin.Context) (err error)

func (*Service) DeleteWorkshopHandler

func (s *Service) DeleteWorkshopHandler() gin.HandlerFunc

DeleteWorkshopHandler deletes a workshop.

func (*Service) ListWorkshopHandler

func (s *Service) ListWorkshopHandler() gin.HandlerFunc

ListWorkshopHandler lists workshops.

func (*Service) ListWorkshops

func (s *Service) ListWorkshops(ctx *gin.Context) (list WorkshopList, err error)

func (*Service) Run

func (s *Service) Run(ctx context.Context) (err error)

type UnimplementedEventServiceServer

type UnimplementedEventServiceServer struct {
}

UnimplementedEventServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedEventServiceServer) CreateWorkshop

func (UnimplementedEventServiceServer) GetWorkshops

type UnsafeEventServiceServer

type UnsafeEventServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeEventServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to EventServiceServer will result in compilation errors.

type Workshop

type Workshop struct {
	Id           string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Instance     string                 `protobuf:"bytes,2,opt,name=instance,proto3" json:"instance,omitempty"`
	WorkshopInfo *Workshop_Info         `protobuf:"bytes,3,opt,name=workshopInfo,proto3" json:"workshopInfo,omitempty"`
	Starts       *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=starts,proto3" json:"starts,omitempty"`
	Ends         *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=ends,proto3" json:"ends,omitempty"`
	// Types that are assignable to BelongsTo:
	//	*Workshop_Event
	//	*Workshop_EventID
	BelongsTo isWorkshop_BelongsTo `protobuf_oneof:"belongsTo"`
	// contains filtered or unexported fields
}

func (*Workshop) Descriptor deprecated

func (*Workshop) Descriptor() ([]byte, []int)

Deprecated: Use Workshop.ProtoReflect.Descriptor instead.

func (*Workshop) GetBelongsTo

func (m *Workshop) GetBelongsTo() isWorkshop_BelongsTo

func (*Workshop) GetEnds

func (x *Workshop) GetEnds() *timestamppb.Timestamp

func (*Workshop) GetEvent

func (x *Workshop) GetEvent() *Event

func (*Workshop) GetEventID

func (x *Workshop) GetEventID() string

func (*Workshop) GetId

func (x *Workshop) GetId() string

func (*Workshop) GetInstance

func (x *Workshop) GetInstance() string

func (*Workshop) GetStarts

func (x *Workshop) GetStarts() *timestamppb.Timestamp

func (*Workshop) GetWorkshopInfo

func (x *Workshop) GetWorkshopInfo() *Workshop_Info

func (*Workshop) ProtoMessage

func (*Workshop) ProtoMessage()

func (*Workshop) ProtoReflect

func (x *Workshop) ProtoReflect() protoreflect.Message

func (*Workshop) Reset

func (x *Workshop) Reset()

func (*Workshop) String

func (x *Workshop) String() string

type WorkshopList

type WorkshopList struct {
	Items  []*Workshop    `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	Paging *paging.Paging `protobuf:"bytes,2,opt,name=paging,proto3" json:"paging,omitempty"`
	// contains filtered or unexported fields
}

func (*WorkshopList) Descriptor deprecated

func (*WorkshopList) Descriptor() ([]byte, []int)

Deprecated: Use WorkshopList.ProtoReflect.Descriptor instead.

func (*WorkshopList) GetItems

func (x *WorkshopList) GetItems() []*Workshop

func (*WorkshopList) GetPaging

func (x *WorkshopList) GetPaging() *paging.Paging

func (*WorkshopList) ProtoMessage

func (*WorkshopList) ProtoMessage()

func (*WorkshopList) ProtoReflect

func (x *WorkshopList) ProtoReflect() protoreflect.Message

func (*WorkshopList) Reset

func (x *WorkshopList) Reset()

func (*WorkshopList) String

func (x *WorkshopList) String() string

type Workshop_Event

type Workshop_Event struct {
	Event *Event `protobuf:"bytes,6,opt,name=event,proto3,oneof"`
}

type Workshop_EventID

type Workshop_EventID struct {
	EventID string `protobuf:"bytes,7,opt,name=eventID,proto3,oneof"`
}

type Workshop_Info

type Workshop_Info struct {
	Title        string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Slug         string `protobuf:"bytes,2,opt,name=slug,proto3" json:"slug,omitempty"`
	LocationName string `protobuf:"bytes,3,opt,name=locationName,proto3" json:"locationName,omitempty"`
	LocationURL  string `protobuf:"bytes,4,opt,name=locationURL,proto3" json:"locationURL,omitempty"`
	Couples      bool   `protobuf:"varint,5,opt,name=couples,proto3" json:"couples,omitempty"`
	// contains filtered or unexported fields
}

func (*Workshop_Info) Descriptor deprecated

func (*Workshop_Info) Descriptor() ([]byte, []int)

Deprecated: Use Workshop_Info.ProtoReflect.Descriptor instead.

func (*Workshop_Info) GetCouples

func (x *Workshop_Info) GetCouples() bool

func (*Workshop_Info) GetLocationName

func (x *Workshop_Info) GetLocationName() string

func (*Workshop_Info) GetLocationURL

func (x *Workshop_Info) GetLocationURL() string

func (*Workshop_Info) GetSlug

func (x *Workshop_Info) GetSlug() string

func (*Workshop_Info) GetTitle

func (x *Workshop_Info) GetTitle() string

func (*Workshop_Info) ProtoMessage

func (*Workshop_Info) ProtoMessage()

func (*Workshop_Info) ProtoReflect

func (x *Workshop_Info) ProtoReflect() protoreflect.Message

func (*Workshop_Info) Reset

func (x *Workshop_Info) Reset()

func (*Workshop_Info) String

func (x *Workshop_Info) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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