Order Domain

Defines the domain object for the order service example.

Path
docs/examples/order_service/src/domain.gb
Category
Order Service

Domain classes keep business data and simple behaviour close together.

Source

module order_service.src.domain;

export class Order {
    string id;
    string customer;
    int totalCents;

    func Order(string id, string customer, int totalCents) {
        this.id = id;
        this.customer = customer;
        this.totalCents = totalCents;
    }

    func label(): string {
        return this.id + " for " + this.customer;
    }
}